我作了一个三层系统,数据是Oracle,中间层用TADOConnection连接,客户端用TDCOMConnection连接中间层,用TClientDataSet进行数据传输,但是在执行下列查询时报错!DataMudole.TClientDataSet.Active:=False;
DataMudole.TClientDataSet.CommandText:='Select distinct field1 from table1 where field2 in (select distinct field2 from table2 where 条件1) Order by field2';
DataMudole.TClientDataSet.Active:=True;//执行到这里出错错误为:在获得新的之前,必须释放所有的Row句柄

解决方案 »

  1.   

    试一试在子查询里不要使用distinct'Select distinct field1 from table1 where field2 in (select field2 from table2 where 条件1) Order by field2'
      

  2.   

    CommandText...
    这问题就是为二层而三层
      

  3.   

    zleeway(杂草) 兄:不行呀,我测试了一下,还是报那个错误!
    comanche(太可怕) 兄:你能不能说的再详细点!!
      

  4.   

    你服务器端允许使用commandText的选项打开了吗?
      

  5.   

    客户端怎么有SQL语句,开发的是什么三层?
      

  6.   

    楼主的 SQl放到中间取,通过方法取得 Data,如果你的SQl语句没问题一般不会有问题的
    ClientData.data:=COMObj.GetMydata(.....);
      

  7.   

    zhanghaijun(zhanghaijun) 兄:CommandText选项已经打开了!
    thh820630(空吻) 兄:能说一下有什么问题么?
    snake_eye(★蛇眼★上帝派来灌水的人) 兄:不好意思,小弟才疏学浅,请指点,老大能不能把关于ClientData.data:=COMObj.GetMydata(.....)给一段详细代码!!
      

  8.   

    order by的问题吧?sql语句不对。
      

  9.   

    用ADOQuery组件试一试,它处理sql语句比较灵活。
      

  10.   

    举例一个:
         ADOQuery1.Close ;
         ADOQuery1.SQL.Clear ;
         ADOQuery1.SQL.Add('select * from memory  where askdate='+#39+formatdatetime('yyyy-mm-dd hh:mm',now)+#39);
         ADOQuery1.Open ;
         mess:= ADOQuery1.fieldbyname('message').AsString   ;
         path:= ADOQuery1.fieldbyname('path').AsString
      

  11.   

    你用这样试试:
    DataMudole.TClientDataSet.close;
    DataMudole.TClientDataSet.CommandText:='Select distinct field1 from table1 where field2 in (select distinct field2 from table2 where 条件1) Order by field2';
    DataMudole.TClientDataSet.open;