delphi使用有问题,快来帮忙呀!

来源:百度知道 编辑:UC知道 时间:2024/05/24 11:04:18
我想用delphi编写一个管理系统登录窗体,用Access做数据库的,用ADOQuery连接

procedure TForm2.Button1Click(Sender: TObject);
var
u,p:string;
begin
//这里用户名为combobox1.Text,密码为Edit1.Text
if(trim(combobox1.Text)='') or (trim(Edit1.Text)='') then
begin
Application.Messagebox('必须输入用户名和密码','提示',64);
Exit;
end
else
begin
u:=combobox1.text;
p:=Edit1.Text;
adoquery1.Close;
adoquery1.SQL.Text := 'select * from UserKey where userName=''' + u + '''';
adoquery1.Open;
adoquery1.Active:=true;
if adoquery1.FieldByName('password').AsString=p then
begin
adoquery1.Close;
form1.Show;
end
else
begin
adoquery1.Close;
Application.Messagebox('请输入正确的用户名和密码','提示',64);
end;
end;

end;

你现在工程中新建立一个窗体,下面所添加在窗体上的控件:
ActionMana