有点乱, procedure TForm1.btn1Click(Sender: TObject); //var //results:Variant; begin if edt1.Text='' then begin application.MessageBox('用户名不能为空!','提示',mb_ok); Exit; end; if edt2.Text='' then begin application.messagebox('密码不能为空!','警告',mb_ok); Exit; end; { if (edt2.Text='')or(edt1.Text='') then begin Application.MessageBox('用户名与密码不可为空!','严重警告!',MB_OK); Exit; end;} with qry1 do begin close; SQL.Clear; SQL.Add('select * from YAQ001 where (LOGIN=:a) and (PASSWORD=:b)'); Parameters.ParamByName('a').Value:=Trim(edt1.Text); Parameters.ParamByName('b').Value:=Trim(edt2.Text); Open; end; //results:=qry1.Lookup('LOGIN',edt1.Text,'PASSWORD'); if qry1.RecordCount>0 then begin Application.MessageBox('登陆成功!','提示',0+64) if edt1.Text='123' then Form2.Show else Form3.show; end else Application.MessageBox('用户编号与密码不正确,请重新输入','提示',0+64); end;
procedure TForm1.btn1Click(Sender: TObject);
//var
//results:Variant;
begin if edt1.Text='' then
begin
application.MessageBox('用户名不能为空!','提示',mb_ok);
Exit;
end;
if edt2.Text='' then
begin
application.messagebox('密码不能为空!','警告',mb_ok);
Exit;
end; { if (edt2.Text='')or(edt1.Text='') then
begin
Application.MessageBox('用户名与密码不可为空!','严重警告!',MB_OK);
Exit;
end;}
with qry1 do
begin
close;
SQL.Clear;
SQL.Add('select * from YAQ001 where (LOGIN=:a) and (PASSWORD=:b)');
Parameters.ParamByName('a').Value:=Trim(edt1.Text);
Parameters.ParamByName('b').Value:=Trim(edt2.Text);
Open;
end;
//results:=qry1.Lookup('LOGIN',edt1.Text,'PASSWORD');
if qry1.RecordCount>0 then
begin
Application.MessageBox('登陆成功!','提示',0+64)
if edt1.Text='123' then
Form2.Show
else
Form3.show;
end
else
Application.MessageBox('用户编号与密码不正确,请重新输入','提示',0+64);
end;