*** 怎么判断TADOQuery的记录是否被改变?**************写一函数,传入一个TADOQuery,无论对ADOQuery做了任何数据改变的操作(增删改)都返回True值。
对于TQuery,用以下方法可以判断出:
  if (Query.Modified) or (Query.UpdatesPending) then
     Result := true;但TADOQuery并没有UpdatesPending属性,偶试了好多其它方法都没判断出,请教高手,谢谢!

解决方案 »

  1.   

    咦,怎么没人知道?在线等。TKS。
      

  2.   

    或者这样也可以。
    var
      customModify : boolean = false;procedure TForm1.ADOQuery1AfterDelete(DataSet: TDataSet);
    begin
       customModify := true;
    end;procedure TForm1.ADOQuery1AfterPost(DataSet: TDataSet);
    begin
       customModify := true;
    end;
      

  3.   

    hch_45(んこん) :    Modified不行。第二种方法倒应该可行,只是麻烦。没其它方法了么?呵呵。
        TKS。
      

  4.   

    1.属性 RowsAffected: Integer;
    Returns the number of rows operated upon by the latest query execution.Description
    Inspect RowsAffected to determine how many rows were updated or deleted by the last query operation. If no rows were updated or deleted, RowsAffected has a value of zero. RowsAffected will have a value of ? if the execution of the SQL statement could not be executed due to an error condition. This latter situation would typically follow the raising of an exception.
    **************
    2.属性 FilterGroupDescriptionUse FilterGroup to filter the recordset displayed with an ADO dataset component. The filter requires the dataset be in update batch mode and the rows are filtered based on the update status of individual rows. Set FilterGroup to a TFilterGroup constant to filter the dataset to show just the rows that match that batch update status. For instance, set FilterGroup to fgPendingRecords to show just the rows that have been modified since the last update application.
      

  5.   

    To FS....你支持什么?呵呵。
    这样:
       if NewValue <> Null then
        //改变 else
        //没有改变。
    or 
      if CompareText(NewValue,OldValue) <> 0 then
        //改变 else
        //没有改变。
    是字段的。
      

  6.   

    To: senhor   Sorry, What's mean r u?
      

  7.   

    数据集,有一个变量的状态。
    实时的可以得到它的三个值
    NewValue OldValue,Value
    可以根据它们判断
      

  8.   

    senhor:TField.NewValue:
    Represents the current value of the field component including pending cached updates.
    "NewValue"好像是针对TField的,不是对于数据集的,不知对否?
    麻烦给个例子,谢谢。
      

  9.   

    加一个onchange事件可以吗?我在别的地方用过,不知道这里有没有
      

  10.   

    procedure TForm1.ADOQuery1BeforePost(DataSet: TDataSet);
    var
      vIndex : Integer;
    begin
      if ADOQuery1.Modified then
        for vIndex := 0 to ADOQuery1.FieldCount - 1 do
         ADOQuery1.Fields[vIndex].Newvalue := ADOQuery1.Fields[vIndex].Oldvalue;
    end;----------------------------------------------------------
    等待,如沙漠行舟,痛苦万分
      

  11.   

    to struggle813
    你那方法不行的...
    我试了一下..