Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1040
  • Last Modified:

Question about ADO cache update (manual post)

I have tried to use ADO cacheupdate in Delphi. Using direct edit, insert and call updatebatch, it works fine. However, I want to do by let a user to directly work with DBGrid and then post the update but using another stored procedure.

Normally, I let the user directly edit/insert the dataset and I write OnBeforePost to Insert/Update manually using stored procedure (via another TADOStoredproc).

ID := DoMyDataSetPost(DataSet);
DataSet.Cancel;
(DataSet as TADODataSet).Requery;
DataSet.Locate('MyPK',ID,[]);
Abort;

The question is how to do this when I am using CacheUpdate. Maybe I have to filter Pending record and loop to post each record like one above, Right?
0
soapsiam
Asked:
soapsiam
  • 3
1 Solution
 
bpanaCommented:
I didn't quite understood your question ...

An example:

- open the ADOTable (or whatever compenent you use)
- set it's connection property to nil. Now you have a disconnected recordset.
- after the user finish his work, update all the modified records (filter the recordset by adFilterPendingRecords)

if needed:
- set the ADOTable connection back to the ADOConnection you use.
- requery ADOTable
0
 
bpanaCommented:
>> The question is how to do this when I am using CacheUpdate. Maybe I have to filter Pending record and loop to post each >> record like one above, Right?

It depends when do you want to update the data. After each record modification or when the user finish all the modifications ?

If after each record, take a look here for an example (I provided an example using a disconnected recordset):
http://www.experts-exchange.com/Programming/Programming_Languages/Delphi/Q_21109554.html

If after all the modifications, you will filter the recordset and for each modified record you will call the corresponding stored proc (insert, update, delete)

If you have any questions, please ask.
Bogdan
0
 
soapsiamAuthor Commented:
Using cached update and Disconnect dataset, Does it have problem with data aware control for example TwwLookupDBCombo?
0
 
bpanaCommented:
i didn't use a TDBLookupCombobox on disconnected datasets, but I don't see why it should be any problem.
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now