How to know about new records with CashedUpdates?

Discussion of open issues, suggestions and bugs regarding SDAC (SQL Server Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
jürgen
Posts: 3
Joined: Fri 19 Jun 2009 11:03

How to know about new records with CashedUpdates?

Post by jürgen » Fri 19 Jun 2009 12:01

Hello,

from TMSQuery.UpdatePendings i can get the information, that the RecordSet has been changed. Is there a similar function that informs me that they are new records inserted in the Query?

I don't want to check the UpdateStatus (=usInserted) of each record or set the UpdateRecordTypes to usInserted because the query is part of a Master-Detail-Subdetail relationship.

I'm looking for the UpdateStatus of the whole RecordSet and not of each record.

Dimon
Devart Team
Posts: 2885
Joined: Mon 05 Mar 2007 16:32

Post by Dimon » Fri 19 Jun 2009 12:55

SDAC has no property to check that new records were inserted in the Query. In order to solve this problem you can use thge UpdateStatus method.

Ludek
Posts: 296
Joined: Thu 12 Oct 2006 09:34

Post by Ludek » Fri 19 Jun 2009 14:49

or following could help, I think:

dataset.UpdateRecordTypes := [rtInserted];

jürgen
Posts: 3
Joined: Fri 19 Jun 2009 11:03

Post by jürgen » Sat 20 Jun 2009 01:07

Thank you for your suggestions.

I want to avoid both, because it's nasty work setting Bookmarks, DisableControls, clearing MasterSource and looping through the records and then setting all back.

I did it with a new function checking the Cache now:

function TMemData.GetInsertedPending: boolean;
var
CacheItem: TCacheItem;
begin
Result := False;
CacheItem := Cache;
while (CacheItem nil) and not Result do begin
Result := CacheItem.Item.Status = isAppended;
CacheItem := CacheItem.Next;
end;
end;

and additional GetDeletedPending.

Hope that will not result in other conflicts.

Dimon
Devart Team
Posts: 2885
Joined: Mon 05 Mar 2007 16:32

Post by Dimon » Mon 22 Jun 2009 07:26

It is good to see that this problem has been solved.

Post Reply