Arsip: [Ask]User login ID and password

 
user image
more 7 years ago

vahnkrist


procedure TForm1.Button1Click(Sender: TObject);
var a,b : String;
begin
with dm.qData do
  begin
   close;
    Sql.Clear;
   a := Sql.Add('Select userid from Identitas');
   b := Sql.Add('Select pass from Identitas');
    open;
     if (a = Edit1.text) and (b = Edit2.Text)
     then
     Label3.Caption := 'OK' ;// buat tes doang kalo konek dan sama seperti di tabeldbase brarti "OK"
  end;
end;
sori mau nanya lagi kk2...adakah yang salah dengan koding di atas ^

a := IntToStr(Sql.Add('Select userid from Identitas'));
b := IntToStr(Sql.Add('Select pass from Identitas'));
kalo a ama b yang di koding pertama diganti kek diatas ini ^ , bisa ngerun tapi Dynamic SQL eror SQL error code = -104 Token unknown - line 2,char-1 Select. merasa ada yang aneh...ada saran atau pemecahan kk2???
user image
more 7 years ago

cartrun

coba gini z gan. procedure TForm1.Button1Click(Sender: TObject); var a,b : String; begin with dm.qData do begin SQL.Clear; SQL.Text:= 'Select * From Identitas Where userid = ' + QuotedStr(Edit1.Text); Close; Open; end; if dm.qData.RecordCount = 0 then begin ShowMessage('User tidak terdaftar'); Edit1.SetFocus; end else if (dm.qData.RecordCount >= 1) and (dm.qData.FieldbyName('pass').AsString <> Edit2.Text) then begin ShowMessage('Password salah'); Edit2.SetFocus; end else begin Hide; Form.Show; end; end;
user image
more 7 years ago

vahnkrist

thanks kak.... diganti "=" tapi yg <> nya.... :D :D
user image
more 7 years ago

cartrun

@vahnkrist: thanks kak.... diganti "=" tapi yg <> nya.... :D :D
sep dah klau udh jalan. silahkn ganti" juga gpp. kn logika itu berbeda" yg pnting tujuannya sama. good luck.!
more ...
  • Pages:
  • 1
Share to

Random Topic

Local Business Directory, Search Engine Submission & SEO Tools FreeWebSubmission.com SonicRun.com