本帖最后由 wenchaowang 于 2010-12-09 17:33:17 编辑

解决方案 »

  1.   

    Adodataset1.CommandText:='select * from log where 用户名=:user and 密码=:password';
    少了个:
      

  2.   

    Adodataset1.CommandText:='select * from log where 用户名=:user and 密码=:password';password前少了两点
      

  3.   

    哦,谢谢你的提示,我加上了,可是它提示“语法错误(操作符丢失)在查询表达式‘用户名=?and密码?’中
      

  4.   

    AdoDataSet1:=TAdoDataset.Create(self);
      adoDataset1.Connection:=adoconnection1;
      adodataset1.CommandType:=cmdtext;
      Adodataset1.CommandText:='select * from log where 用户名=:user and 密码=password';
      adodataset1.close;
      Adodataset1.Parameters.Clear;
      Adodataset1.Parameters.AddParameter;
      adodataset1.Parameters[0].name:='user';
      adodataset1.Parameters[0].DataType:=ftstring;
      Adodataset1.Parameters[0].Direction:=pdinput;
      adodataset1.Parameters[0].Value:=edit1.text;
      Adodataset1.Parameters.AddParameter;
      adodataset1.Parameters[1].name:='password';
      adodataset1.Parameters[1].DataType:=ftstring;
      Adodataset1.Parameters[1].Direction:=pdinput;
      adodataset1.Parameters[1].Value:=edit2.text;
      adodataset1.active:=true;
     if adodataset1.Recordset.RecordCount=1 then
    ->  // 转成下面的看看AdoDataSet1:=TAdoDataset.Create(self);
      adoDataset1.Connection:=adoconnection1;
      adodataset1.CommandType:=cmdtext;
      Adodataset1.CommandText:='select * from log where 用户名= '''+edit1.text+
                               ''' and 密码 = '''+edit2.text+'''';
      adodataset1.active:=true;
     if adodataset1.Recordset.RecordCount=1 then
      

  5.   

    谢谢你,这个问题解决了,不过下面运行到这“MessageBox(0, '您进行系统身份确认程序错误已经超过3次,本系统将停止执行!',
      '', MB_OK + MB_ICONSTOP);
        close;
      end;
    ”close这边出问题了,你能不能帮我看一下,嘿嘿~谢谢!
      

  6.   

    系统提示错误“access violation at adress 0045AD26 in module interface.exe. Read of address 000002F4" 我单步运行到上面的“close”就出现这个错误了,我对delphi不是太了解,还请大家帮忙呀。
      

  7.   

    而且还有个错误就是我的用户名或者密码输的是错误的它执行的“showmessage('密码确认,即将进入河水水质预警系统');”这是怎么回事呀?我只是想从这个界面输入用户名和密码然后进入系统,只是输入的密码或者用户名有三次错误就自动关闭。请高手帮我看看呗。
      

  8.   

    改成:
     if count=0 then
      begin
        MessageBox(0, '您进行系统身份确认程序错误已经超过3次,本系统将停止执行!', '提示', 64);
        Application.Terminate;
      end;
      

  9.   

    如果上面的没能解决问题,你最好检查一下你的DPR工程文件里面的建FORM相关语句.