我在做一个简单得系统登陆,在判断用户名的时候总是出错,弹出的对话框是这样的,请各位高手指点
程序代码如procedure TForm2.BitBtn1Click(Sender: TObject);
var strid,strpwd:string;
begin
strid:=trim(edit1.Text);
strpwd:=trim(edit2.text);
if (trim(edit1.text)<>'') and (edit2.text<>'') then
begin
with dm.query1 do
begin
close;
sql.clear;
sql.add('select * from user where username=:strid and psw=:strpwd');
parameters.ParamByName('strid').value:=trim(edit1.Text);
parameters.ParamByName('strpwd').value:=trim(edit2.text);
open;
end;
if dm.query1.recordcount>0 then
begin
label3.Caption:='欢迎您'+strid;
//form2.Hide;
//application.createform(tform1,form1);
//form1.ShowModal;
//form1.Free;
//form1.StatusBar1.Panels[0].text:=form1.StatusBar1.Panels[0].text+strid;
end
else
showmessage('你输入的用户名或密码不正确,请重新输入');
end;
end;
end.下: