Solved

Question about ADO cache update (manual post)

Posted on 2004-08-25
4
1,014 Views
Last Modified: 2008-01-09
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
Comment
Question by:soapsiam
  • 3
4 Comments
 
LVL 6

Expert Comment

by:bpana
Comment Utility
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
 
LVL 6

Accepted Solution

by:
bpana earned 125 total points
Comment Utility
>> 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
 
LVL 1

Author Comment

by:soapsiam
Comment Utility
Using cached update and Disconnect dataset, Does it have problem with data aware control for example TwwLookupDBCombo?
0
 
LVL 6

Expert Comment

by:bpana
Comment Utility
i didn't use a TDBLookupCombobox on disconnected datasets, but I don't see why it should be any problem.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now