Re: Check for pending updates in batch mode?
- From: "Val Mazur \(MVP\)" <group51a@xxxxxxxxxxx>
- Date: Sun, 26 Jun 2005 10:52:18 -0400
Hi Ian,
No, ADO recordset does not have such a property. You need to use Filter to
get a list of the changes.
--
Val Mazur
Microsoft MVP
http://xport.mvps.org
"Ian Boyd" <ian.msnews010@xxxxxxxxxxxx> wrote in message
news:uGxs20EeFHA.720@xxxxxxxxxxxxxxxxxxxxxxx
> 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);
>
.
- References:
- Check for pending updates in batch mode?
- From: Ian Boyd
- Check for pending updates in batch mode?
- Prev by Date: Re: ADO Data Control Error Message "Unexpected end of statement"
- Next by Date: Re: 80040154|Class_not_registered
- Previous by thread: Check for pending updates in batch mode?
- Next by thread: ADO Data Control Error Message "Unexpected end of statement"
- Index(es):