DM.File_Query1.close;
DM.File_Query1.sql.clear;
DM.File_Query1.SQL.add('select * from filedata where');
SQLstr:=FindCB2.text+' '+MatchEd2.text+' '+ StrToFloat(FindEd2.text);
问题如下:以上语句编译时出错,主要是这句不知道应该怎么写StrToFloat(FindEd2.text),请高手指点。
StrToFloat(FindEd2.text)出错是在这句,我的目的主要是查询数据库里的一个字段值(这个字段的类型是Float型),请问这句应该怎么改才对。

解决方案 »

  1.   

    错的可远了1、编译出错是因为SQLstr是字符型,StrToFloat(FindEd2.text)转换成浮点数字,数字怎么可以赋值给字符类型?
    2、DM.File_Query1.SQL.add('select * from filedata where');本身就不是一个完整的SQL语句其实本来很简单一个东西
    DM.File_Query1.SQL.add('select * from filedata');
    DM.File_Query1.SQL.add('where '+传递的字段+'='+FindEd2.text);
      

  2.   

    ---------------------------
    DBISAM Engine Error # 11949 SQL parsing error - Expected column name but instead found 年龄20 in SELECT SQL statement at line 2, column 7.
    ---------------------------
    确定   
    ---------------------------
    DM.File_Query1.SQL.add('where '+传递的字段+'='+FindEd2.text);
    当我把上面这句改成下面这样时提示出错,出错信息如上,MatchEd2.text中显示的是等于号
    DM.File_Query1.SQL.add('where '+FindCB2.text+MatchEd2.text+FindEd2.text);
      

  3.   

    请高手指点。
    ---------------------------
    DBISAM Engine Error # 11949 SQL parsing error - Expected column name but instead found 年龄20 in SELECT SQL statement at line 2, column 7.
    ---------------------------
    确定   
    ---------------------------
    DM.File_Query1.SQL.add('where '+传递的字段+'='+FindEd2.text);
    当我把上面这句改成下面这样时提示出错,出错信息如上,MatchEd2.text中显示的是等于号
    DM.File_Query1.SQL.add('where '+FindCB2.text+MatchEd2.text+FindEd2.text);
      

  4.   

    老大,我真TM服了你了DM.File_Query1.SQL.add('where '+FindCB2.text+MatchEd2.text+FindEd2.text);这一句中,说对也对,说错也错,关键是FindCB2.text、MatchEd2.text、FindEd2.text分别是什么东西根据这三个录入值得到一个完整的SQL语句不麻烦吧,但是你得控制这3个地方分别是什么东西,否则什么都不是。