这个问题总是反复出现
如:FORM1.SQL.Add('select * from 教工基本信息表 where 部门="master office"');
就提示:列名"master office"无效
怎么回事啊?

解决方案 »

  1.   

    如果是Query1.SQL.Add('select * from 教工基本信息表 where 部门="master office"');
    的话好象没什么大问题。
      

  2.   

    Query1.SQL.Add('select * from 教工基本信息表 where 部门="master office"')
    该为
    Query1.SQL.Add('select * from 教工基本信息表 where 部门=''master office''')
    另外建议 表名和字段名读不要用中文!
      

  3.   

    不要用全角的引号。ghy412(良苦用心)提的建议很好。
      

  4.   

    select * from 教工基本信息表 where 部门="master office"
    修改
    select * from 教工基本信息表 where 部门=:para
    而后代入参数;
    或是
    你的“部门”字段修改为“bm”试试。
      

  5.   

    FORM1.SQL.Add('select * from 教工基本信息表 where 部门="master office"');
    改为:
    var
      ssql:  string;
    begin
      ssql := 'select * from 教工基本信息表 where 部门='+#39+'master office'+ #39;
      form1.sql.clear;
      form1.sql.add(ssql); 
      ......
    end;
      

  6.   

    Query1.SQL.Add(format('select * from 教工基本信息表 where 部门=''%s''',['master office']);
    OK了。不要用中文表格和中文字段。
      

  7.   

    我要说的和pdbird(老巢)的一样,就不重复了