adotable怎么查找下一条记录delphi拜托了各位 谢谢
beginwithData_M.ADO_userdobeginiftrim(Fieldbyname('username').Value)=edit1.Textthenbe...
begin with Data_M.ADO_user do begin if trim(Fieldbyname('username').Value) = edit1.Text then begin if trim(Fieldbyname('password').Value) = edit2.Text then begin next; main_form.Show; login_form.Visible := false; end else begin showmessage('您输入的密码错误'); edit1.SetFocus; end; end else begin showmessage('您输入的账号有误'); edit2.SetFocus; end; end; end; 表中有两条记录 username password 1.admin admin 2.jeff 123 我这样子写只能找到第一条admin的记录 而jeff这条记录一直找不到 哪里错了呢 如果使用过滤器 filter :='name = ''' + edit1.Text + '''' ; filtered := true; 怎么添加修改代码???
展开
2个回答
展开全部
begin with Data_M.ADO_user do begin close; sql.clear; sql.add('select * from 表 where username='''+edit1.text+''' '); open; if RecordCount>0 then begin if trim(Fieldbyname('password').Value) = edit2.Text then begin main_form.Show; login_form.Visible := false; end else begin showmessage('您输入的密码错误'); edit1.SetFocus; end; end else begin showmessage('您输入的账号有误'); edit2.SetFocus; end; end; end;
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询