ADO, Master-Detail, UpdateBatch

ADO, Master-Detail, UpdateBatch

Post by Maciej Serafi » Sat, 09 Feb 2002 17:57:57



Hello.
I use Delphi 5,SP1, ADO update 2, MS-SQL v.7.
I have two TADODataSet components in master/detail relationship. I use
ltBatchOptimistic for both of them.
They were using client-side cursors, cursortype to ctStatic.

The pseudo-code example is described below:
Master Insert
Master Updates
Detail Insert
Detail Updates
Master Post
Detail Post (called in Master's AfterPost event)
Master UpdateBatch
Detail UpdateBatch
I expected Master Post method to be executed, but the Detail Post method
had been called instead... This change in calling order causes the lost
of detail data, and when calling Update Batch for Master and Detail only
master record is posted to the database.
Let me know, if I'm doing something wrong.
Thanks,
P.S. Can You send to me example code.

M.S.

 
 
 

1. UpdateBatch and Master-detail insert

Hi all,

I'm trying to use UpdateBatchto handle inserts to a master detail recordset.
I load an empty RS based on a shape command (I use params that will bring
back an empty RS). I enter a master record and then a detail record. Call
UpdateBatch(adAffectAll) then call a routine that will cycle through the
Child RS and then do UpdateBatch(adAffectAllChapters) on the Child RS. (I
establish new connections for the child RS)

What happens is that from the time I issue the first
UpdateBatch(adAffectAll) to update the master record, the record in the
child RS disappears.

Any ideas? Is it that I can't do this kind of insert using UpdateBatch? The
UpdateBatch works if the master record already exists. In other words if I
load an existing master-detail and do any updates (including adding new
detail records) it works fine but if I try to create a new master-detail
then no joy.

Any help will be appreciated.

TIA,

Kevin

2. NewEra...What do you think??

3. Selecting from Master/Detail w/ Detail as columns of Master

4. Newbie SQL update question

5. ADO against Access (Master/Detail)

6. Informix-4gl book available from Prentice-Hall

7. ADO Master/Detail Addnew Update???

8. Named Pipes: inter PC?

9. Example of Master-Detail ADO in code?

10. master - detail in one row, details in one extra column

11. Counting Details on a Master-Detail Relatioship

12. Master-detail-detail-detial with Cascade delete

13. Sorting detail records in a master detail relation.