Answer» I am just new in delphi and i had a hard time in USING it. One of my problem is the LOGIN form which has 3 users of different privileges. The code I have has plenty of ERRORS and I can't STILL pinpoint the correct code for it. I hope you could check it and give me some FEEDBACK about it.
Below is the my code:
procedure Tform_login.Button1Click(Sender: TObject); var form:Tform_studhome; form:Tform_phyhome; form:Tform_homestaff; username, password, privelege :String;
begin zquery1.SQL.Clear; zquery1.SQL.Add ('select username, password from account where username= '''+edit1.Text+''''); zquery1.Active := true; username := zquery1.Fields[1].AsString; password := zquery1.Fields[2].AsString;
if ((username = edit1.Text) and (password = edit2.Text)) then begin ShowMessage('Login Successful!'); zquery1.Active :=True; zquery1.SQL.Add('select privelege, user_idno from account where username = '''+edit1.Text+''''); privelege := zquery1.Fields[3].AsString;
if(privelege = 'student') then begin form:=Tform_studhome.Create(self); form.Show; close; end
else if(privelege = 'physician') then begin form:=Tform_phyhome.Create(self); form.Show; close; end
else if(privelege = 'staff') then begin form:=Tform_homestaff.Create(self); form.Show; close; end
end;
end;
Thanks and more power.
|