代码:
begin
with adotable1 do
begin
if ADOTable1.Lookup('kh',edit1.Text,'mm')=edit2.Text then
  begin
     form3.show;
   end
else
   showmessage('对不起,没有该用户');
end;
end;
整个程序只有一张表(用户表),进入form3后..显示的是第一条记录的信息,如果实现用哪个用户名登陆,进入form3后显示的就是哪个用户的信息?代码该怎么写?谢谢啦!

解决方案 »

  1.   

    begin
    with adotable1 do
    begin
      with ADOQuery1 do
      begin
        Close;
        SQL.Clear;
        SQL.Add('select * from 用户表 where 用户名=' + QuotedStr(Edit1.Text) + ' and 用户密码=' + QuotedStr(Edit2.Text));
        Open;
        if not IsEmpty then
          form3.show
        else showmessage('对不起,没有该用户');
      end;
    end;
      

  2.   

    将登录信息保存到变量中,在form3.show的时候显示就Ok了。
      

  3.   

    form3中直接读取form1中username的edit中的内容