以下是代码
procedure TForm1.Button1Click(Sender: TObject);
begin
with  adoquery1 do
begin
close;
SQL.Clear;
Sql.Add('select * from test where (id=:a) and (code=:b) ');
parameters.ParamByName('a').Value:=Trim(edit1.Text);
parameters.ParamByName('b').Value:=Trim(edit2.Text);
open;
end;
if adoquery1.RecordCount>0 then
 application.MessageBox('登录成功!','提示',0+64)
 else
 application.MessageBox('用户名或密码不正确,请重新输入!','提示',0+64);  
end;end.