三层架构(COM+做服务端)
服务端: ADOQUERY+DataSetProvider
客户端:DCOMConnection+CLientDataSet服务端只有:ADOQUERY+DataSetProvider
客户端执行以下语句:
begin
  DCOMConnection.Connected :=True;
  ClientDataSet.Close;
  ClientDataSet.CommandText :='';
  ClientDataSet.CommandText :='select * from table where xxxxx';
  ClientDataSet.Open;
  DCOMConnection.Connected :=False;
end;问题是每次CommandText都不同,为何每次取出来的结果都是第一次的!!!
寻原因及解决方案。

解决方案 »

  1.   

    begin
      DCOMConnection.Connected :=True;
      ClientDataSet.Close;
      
      ClientDataSet.Data:=null;
      ClientDataSet.CommandText :='select * from table where xxxxx';
      ClientDataSet.Open;
      DCOMConnection.Connected :=False;
    end;
    呵呵,你试试看
     
      

  2.   

    begin
      DCOMConnection.Connected :=True;
      ClientDataSet.Close;
      ClientDataSet.open
      ClientDataSet.CommandText :='';
      ClientDataSet.CommandText :='select * from table where xxxxx';
      DCOMConnection.Connected :=False;
    end;
    这样应该就不会了,你看看