dm.ADOQueryFlg.SQL.Text:='select flg from information where 学级 = '''+txtgrade.Text+''',专业 = '''+txtdep.Text+''',班级 = '''+txtclass.Text+'''';
    edit1.Text:= dm.ADOQueryFlg.FieldValues['flg'];
运行时他非说我flg字段找不到!!!可是我information表里有这个字段!!!为什么啊???!!!
dm 为DataModule

解决方案 »

  1.   

    首先,你的sql不正确
    其次,你的ADOQueryFlg open了没dm.ADOQueryFlg.SQL.Text:='select flg from information where 学级 = '''+txtgrade.Text+''' and 专业 = '''+txtdep.Text+'''  and 班级 = '''+txtclass.Text+'''';
    dm.ADOQueryFlg.Open;
    edit1.Text:= dm.ADOQueryFlg.FieldValues['flg'];
      

  2.   

    谢谢,我刚看到SQL语句错了,嘻嘻,写的时候脑子有点晕.谢谢你!
    不过问一个问题,为什么还得open啊??
      

  3.   

    select ,...查询的方法就得有返回结果.所以要用open 如果是执行数据修改新增删除操作,就只能用 execsql