Check for pending updates in batch mode?
- From: "Ian Boyd" <ian.msnews010@xxxxxxxxxxxx>
- Date: Thu, 23 Jun 2005 19:42:25 -0400
Is there a flag, or a status, or a state that lets me know that my recordset
in batch update mode has some pending updates?
The Status property only applies to my current record. i want to know if any
rows have pending updates - without having to do something like:
rs.Filter := adFilterPendingRecords;
bbSaveChanges.Enabled := (rs.RecordCount <> 0)
rs.Filter := adFilterNone;
Since i don't need a list of the pending update records, just if any exist.
Plus, i am sure that the check
if rs.Status <> adRecUnmodified then
is not valid - since there are other Statuses that also are synonymous with
"Unmodified" (i.e. adRe***)
i could do something like:
rs.MoveFirst;
while not rs.EOF do
begin
if rs.Status <> adRecUnmodified then
begin
bbSaveChanges.Enabled := True;
Exit;
end;
end;
bbSaveChanges.Enabled := False;
But i was hoping there was a more efficient (ADO provided) system. Also,
that is a lot of code to write every time i want the simple check.
i could put one the above in a function; but then i am either modifying the
Filter on my recordset, or moving around the recordset. In both cases,
losing my current record.
So i could then write something like:
function RecordsetPendingUpdates(rs: Recordset): Recordset;
var
OldFilter: OleVariant;
OldRecord: OleVariant;
begin
OldFilter := rs.Filter;
OldRecord := rs.Bookmark;
rs.Filter := adFilterPendingRecords;
Result := (rs.RecordCount <> 0);
rs.Filter := OldFilter;
rs.Bookmark := OldRecord;
end;
But now i've had to tell ADO to compile me a list of all records that have
been modified (which i don't really want).
And then compile a list of the existing records (which i had already)
And then seek to where ever the user was.
It would be easier if there was a syntax similar to
bbSaveChanges.Enabled := (rs.Status <> adRecPendingChanges);
.
- Follow-Ups:
- Re: Check for pending updates in batch mode?
- From: Val Mazur \(MVP\)
- Re: Check for pending updates in batch mode?
- Prev by Date: Re: Unable to Update Data table in Access Database via ADO
- Next by Date: Re: escaping semi colon in connectionstring
- Previous by thread: Problem getting data in to Excel from a stored procedure
- Next by thread: Re: Check for pending updates in batch mode?
- Index(es):