begin
  adodataset1.commandtext:='select * from 用户操作表 where 用户名='''+suiedit1.text+''' and 密码='''+suiedit2.text+'''' ;
  adodataset1.Close;
  if suiedit1.Text:=用户名 and =suiedit2.Text:=密码 then
  begin
    suimsnpopform1.Popup;
  end
  else
  begin
  if MessageDlg('您输入的用户名和密码错误,请检查!',mtwarning,[mbok,mbcancel],0)=mrok  then  suiedit1.Text:='';
  suiedit2.Text:='';
  suiedit1.SetFocus;
  end;
 end;上面这段程序中的这行语句
 if suiedit1.Text:=用户名 and =suiedit2.Text:=密码 then
应该怎么写才对。(数据库中2个字段:用户名和密码)

解决方案 »

  1.   

    if suiedit1.Text=AdoDateSet1.fieldByName('用户名').Value and suiedit2.Text=AdoDateSet1.fieldByName('密码').Value then
      

  2.   

    这里还有问题:
      adodataset1.Close;
    adodataset1.commandtext:='select * from 用户操作表 where 用户名='''+suiedit1.text+''' and 密码='''+suiedit2.text+'''' ;
      adodataset1.Open;
      

  3.   

    if (suiedit1.Text=AdoDateSet1.fieldByName('用户名').Asstring)and 
    (suiedit2.Text=AdoDateSet1.fieldByName('密码').AsString )then
      

  4.   

    if (suiedit1.Text=用户名) and (suiedit2.Text=密码) then
      

  5.   

    提示AdoDateSet1.fieldByName这2个没定义,该怎么办
      

  6.   

    select 语句查询表中和suiedit1中的用户名相同的的记录,然后判断密码是否和suieidt1 中的相同,思路错了
      

  7.   

    if (suiedit1.Text=AdoDateSet1.fieldByName('用户名').Asstring)and 
    (suiedit2.Text=AdoDateSet1.fieldByName('密码').AsString )then
    这行还是出错
    提示undeclared identifier 'adodataset1'
      

  8.   

    select 语句查询表中和suiedit1中的用户名相同的的记录,然后判断密码是否和suieidt1 中的相同,思路错了照这样的应该怎么写,帮忙一下,急
      

  9.   

    看首部 uses中有Tadodataset没有
      

  10.   

    begin
      adodataset1.commandtext:='select * from 用户操作表 where 用户名='''+suiedit1.text+'''' ;
      adodataset1.Close;
      if (suiedit2.Text=AdoDateSet1.fieldByName('密码').AsString )then
      begin
        suimsnpopform1.Popup;
      end
      else
      begin
      if MessageDlg('您输入的用户名和密码错误,请检查!',mtwarning,[mbok,mbcancel],0)=mrok  then  suiedit1.Text:='';
      suiedit2.Text:='';
      suiedit1.SetFocus;
      end;
     end;
      

  11.   

    if (suiedit2.Text=AdoDateSet1.fieldByName('密码').AsString )then
    这句话不行的呀
    我改成if suiedit2.Text='密码' then 这样可以运行的
    但是运行后每次都是跳出“您输入的用户名和密码错误,请检查”
    不知道是哪个循环里出了错,请帮我一起看一下
      

  12.   

    begin
      adodataset1.close;
      adodataset1.commandtext:='select * from 用户操作表 where 用户名='''+suiedit1.text+''' and 密码='''+suiedit2.text+'''' ;
      adodataset1.open;
      if (suiedit1.Text=AdoDateSet1.fieldByName('用户名').AsString) and (suiedit2.Text=AdoDateSet1.fieldByName('密码').AsString) then
      suimsnpopform1.Popup
      else
      begin
      if MessageDlg('您输入的用户名和密码错误,请检查!',mtwarning,[mbok,mbcancel],0)=mrok  then
      begin
        suiedit1.Text:='';
        suiedit2.Text:='';
        suiedit1.SetFocus;
      end;
      end;
     end;
      

  13.   

    if (suiedit2.Text=AdoDateSet1.fieldByName('密码').AsString )then
    这句话不行的呀
    我改成if suiedit2.Text='密码' then 这样可以运行的
    但是运行后每次都是跳出“您输入的用户名和密码错误,请检查”
    不知道是哪个循环里出了错,请帮我一起看一下
      

  14.   

    建议先用变量接收AdoDateSet1.fieldByName('密码').AsString ,然后调试就比较清楚了
      

  15.   

    回复人: lvboliang(一把剑) ( ) 信誉:100 看他的  
      adodataset1.close;
      adodataset1.commandtext:='select * from 用户操作表 where 用户名='''+suiedit1.text+''' and 密码='''+suiedit2.text+'''' ;
      adodataset1.open;