Delphi-Quellcode:
procedure TForm1.Button1Click(Sender: TObject);
begin
Query1.SQL.Text:='
Select * From USER where user=:user and password=:pass';
Query1.ParamByName('
user').AsString := Edit1.Text;
Query1.ParamByName('
pass').AsString := Edit2.Text;
Query1.Open
if not Query1.Eof
then
begin
case Query1.FieldByName('
SECTION').AsString
of
'
1' :
begin
self.Hide;
Form2.Showmodal;
end;
'
2' :
begin
self.Hide;
Form3.Showmodal;
end;
else
ShowMessage('
Database error: unknown or missing section');
end;
{case------------------------------------------------------}
end else
ShowMessage('
Wrong User or Password!');
Query1.Next;
if not(Query1.EOF)
then
ShowMessage('
Database error: more than one record found');
Query1.Close;
{-- die Query sauber hinterlassen }
end;
Noch ein paar Kleinigkeiten hinzu gefügt.
Gruß
K-H