Board index » delphi » ADO Master/Detail and Batch Update Problem

ADO Master/Detail and Batch Update Problem


2007-03-26 05:36:11 PM
delphi252
Environment:
SQL Server 2000 Update Pack 4
XP service pack 2
BDS 2006 update pack 2
Development Scenario
Master ADO Query SQL statement is: "select * from master order by idmaster;"
Detail ADO Query SQL statement is: "select * from detail where idmaster =
:idmaster order by iddetail;"
There is also a Foreign Key : "alter table detail add foreign key (idmaster)
references master (idmaster) on delete cascade;"
Detail ADO Query is linked to Master ADO Query through Master DataSource
Master and Detail CursorType = ctStatic, LockType = ltBatchOptimistic
Problem
When I execute Master UpdateBatch, alla data inserted or modified in the
Detail are deleted and can not be saved with Detail UpdateBatch
What's wrong in my code ?
Thanks Davide
 
 

Re:ADO Master/Detail and Batch Update Problem

I don't know what might be wrong with your code but, to my experience, ADO batch
updates were messy, so instead I chose the ClientDataSet approach which works
just fine.
Davide Pasqualini writes:
Quote
Environment:
SQL Server 2000 Update Pack 4
XP service pack 2
BDS 2006 update pack 2

Development Scenario
Master ADO Query SQL statement is: "select * from master order by idmaster;"
Detail ADO Query SQL statement is: "select * from detail where idmaster =
:idmaster order by iddetail;"
There is also a Foreign Key : "alter table detail add foreign key (idmaster)
references master (idmaster) on delete cascade;"
Detail ADO Query is linked to Master ADO Query through Master DataSource
Master and Detail CursorType = ctStatic, LockType = ltBatchOptimistic

Problem
When I execute Master UpdateBatch, alla data inserted or modified in the
Detail are deleted and can not be saved with Detail UpdateBatch

What's wrong in my code ?

Thanks Davide


 

Re:ADO Master/Detail and Batch Update Problem

You can not do that since parametrized Detail will be required right after
Post of Master, thus all pending changes will be lost. You have to resort to
masterfield, mastersource approach.