我用database desktop建立了一个系统登陆的表名字为111.dbf(是dbaseiv类型的)
然后我写了代码
:query属性DATABASENAME设置为dbmeos
但是编译没有错误一运行就会提示错误
invilid use of keyboard
token : password
line number:'1'
SQL语句为
Query1.Close;
            Query1.SQL.Clear;
            Query1.SQL.Text:='Select password from 111.dbf where user='''+trim(Edit1.Text)+'''';
            Query1.Open;
请问是那里设置不对或者代码错误!

解决方案 »

  1.   

    Query1.SQL.Text:='Select password from 111.dbf where user='''+trim(Edit1.Text)+'''';111.dbf是数据库, from后面应该是表名
      

  2.   

    顶!
    不是数据库的名字就是表的名字呀
    我的数据库是默认的DEMOS
      

  3.   

    Query1.Close;
    Query1.SQL.Clear;
    Query1.SQL.add('Select password from 111.dbf where user='''+trim(Edit1.Text)+'''');
    Query1.Open;
      

  4.   

    user你把user字段改成userID再试试
      

  5.   

    Select password from {111.dbf} where user=
                            ??
                            这里放的是表名,不带扩展名的
      

  6.   

    Query1.Close;
    Query1.SQL.Clear;
    Query1.SQL.add('Select password from 111.dbf where user=:user');
    query1.Params.ParamByName('user').Value:=trim(edit1.text);
    Query1.Open;
      

  7.   

    Query1.Close;
    Query1.SQL.Clear;
    Query1.SQL.add('Select password from 111 where user=:user');//111.dbf不要DBF,这是扩展名来的
    query1.Params.ParamByName('user').Value:=trim(edit1.text);
    Query1.Open;
      

  8.   


    Query1.SQL.Text:='Select password from 111.dbf where user='''+trim(Edit1.Text)+'''';
    改为
    Query1.SQL.Text:='Select password,User from 111.dbf where user='''+trim(Edit1.Text)+'''';
    看看行不行,我也遇到过这种情况!
                
      

  9.   

    把字段password改成其它名称,再试试。
      

  10.   

    首先感谢大家对我的帮助,
    但是很遗憾,问题还是没有解决!
    我想是不是QUERY本身的问题,因为它是动态查询,所以涉及到很多,是不是写对了代码,
    有时也会出错!
    谢谢!!!
      

  11.   

    我用的是ADOQuery,有时候代码写对了,调试没有错误,就是执行的结果不正确,我对Delphi都开始表示怀疑了
      

  12.   

    Query1.Close;
    Query1.SQL.Clear;
    Query1.SQL.add('Select password from 111.dbf where user=:user');
    query1.Params.ParamByName('user').Value:=trim(edit1.text);
    Query1.Open;
      

  13.   

    把password字段名改为passwords
    password为保留字.
      

  14.   

    user 也是保留字,请把它也改成别的字段名