高手进,下面的程序什么地方出错了

juckxu 2007-04-17 10:10:06
procedure TForm1.Button1Click(Sender: TObject);
var
mm,nn:string;
begin
if edit2.text = '' then
showmessage('请输入您的密码!')
else if edit1.Text = '' then
showmessage('请输入您的帐号!');
if (edit1.Text <> '') and (edit2.Text <> '') then
begin
ADOQuery1.Close;
ADOQuery1.SQL.Clear;
adoquery1.sql.add('select * from Admin where AdminID=:mm and Password=:nn');

adoquery1.parambyname('mm').asstring:=trim(edit1.text);
adoquery1.parambyname('nn').asstring:=trim(edit2.text);
showmessage('用户'+ edit1.text+'你好!系统检测中,请稍候!') ;
adoquery1.open;
if adoquery1.Fields[0].value = '' then
showmessage('帐号不存在!')
else if adoquery1.Fields[1].Value = edit2.Text then
begin
Form2.Show;
Form1.Close;
end
else
showmessage('登录失败,请检查用户名和密码!')
end;
end;

end.
...全文
179 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
redher 2007-04-18
  • 打赏
  • 举报
回复
鼠标选中parambyname ,按F1.
scvzhang 2007-04-18
  • 打赏
  • 举报
回复
不用这么麻烦吧,
'select count(*) from Admin where AdminID=:mm and Password=:nn

if ADOQuery1.RecordCount >0 then
登录成功
else 登录失败

2,497

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 数据库相关
社区管理员
  • 数据库相关社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧