can any one in borland help :Frequntly ApplyUpdate Problem in IBX + CDS
Quote
>borland have way to worry user ?
i start project using CDS + IBX project in D7 + ibx7.05
i read many paper and info in boralnd about it i call with some user in
world about it,many of it report same problem,i use many code for resolving
this problem . at lastest i read this article in borland :
http://info.borland.com/midas/papers/clientdataset/
quote of above :
"using Master/Detail Queries, you cannot cache detail records from different
master records.
a.. Inserting records in detail tables is not possible without changes to
the VCL.
b.. Cached updates with non-live queries require use of TUpdateSQL,
whereas ClientDataset can handle this natively.
Version 3.01 and above of Delphi corrects some of the problems associated
with the first two bullets above; however, there is still one major
limitation to using cached updates. Due to the way cached updates are
implemented, you must apply the updates any time you move from a master
record. This effectively means that your transactions and updates must occur
on one batch of master/detail records. This may suit your needs, and if it
does, you can use the following code written by Mark Edington of Borland.
Attach the code in Figure 5 to the BeforeClose event of the detail table. "
i think not yet solve !. i think it have major problem in update use IBX +
provider + CDS
i have 5 masterdetail db in my project i get frequnly error :
error when call applyupdate when DisableControl
update true when applyupdate with new insert but when edit field not update
many of code work in simple project but when use in project with many
master detail see diffrent responce
//--------------------------------------------------------------------------
----------
// Code 1 :
cdsMaster.CheckBrowseMode;
cdsDetail.CheckBrowseMode;
{Setup the variant with the changes (or NULL if there are none)}
if cdsMaster.ChangeCount > 0 then
MasterVar := cdsMaster.Delta else
MasterVar := NULL;
if cdsDetail.ChangeCount > 0 then
DetailVar := cdsDetail.Delta else
DetailVar := NULL;
{Wrap updates in a transaction. If any step gives an error, raise}
{an exception, which will Rollback the transaction.}
{This would normally be done on the middle tier, i.e.:
SocketConnection.AppServer.ApplyUpdates(DetailVar, MasterVar);}
Database.StartTransaction;
try
ApplyDelta(cdsMaster, MasterVar);
ApplyDelta(cdsDetail, DetailVar);
Database.Commit;
except
Database.Rollback
end;
{If previous step resulted in errors, Reconcile error datapackets}
if not VarIsNull(DetailVar) then
cdsDetail.Reconcile(DetailVar) else
if not VarIsNull(MasterVar) then
cdsMaster.Reconcile(MasterVar) else
begin
cdsDetail.Reconcile(DetailVar);
cdsMaster.Reconcile(MasterVar);
cdsDetail.Refresh;
cdsMaster.Refresh;
end;
//--------------------------------------------------------------------------
-------------------
code 2 :
var
BKMU , BKMI : TBookmark;
begin
BKMI := CDBWI.GetBookmark;
BKMU := CDBWUS.GetBookmark;
try
CDBWI.DisableControls;
CDBWUS.DisableControls;
Screen.Cursor := crSQLWait;
if CDBWUS.ApplyUpdates(-1)=0 then
CDBWUS.Refresh;
finally
// Do this first !!!!!
CDBWUS.GotoBookmark(BKMU);
CDBWI.GotoBookmark(BKMI);
// Then enable controls
CDBWUS.EnableControls;
CDBWI.EnableControls;
Screen.Cursor := crDefault;
end;
//--------------------------------------------------------------------------
----------------
code 3 :
var
BKMU , BKMI : TBookmark;
begin
BKMI := DetCDS.GetBookmark;
BKMU := MasCDS.GetBookmark;
try
Screen.Cursor := crSQLWait;
if (DetCDS.State in dsEditModes) then begin
//DetCDS.DisableControls;
DetCDS.Post ;
//BIE := True;
end;
if (MasCDS.State in dsEditModes) then begin
//MasCDS.DisableControls;
MasCDS.Post;
//BUE := True;
end;
DetCDS.DisableControls;
MasCDS.DisableControls;
if (MasCDS.ChangeCount > 0)then
MasCDS.ApplyUpdates(0);
MasIBDT.Close;
MasIBDT.Open;
MasCDS.Refresh;
finally
MasCDS.GotoBookmark(BKMU);
DetCDS.GotoBookmark(BKMI);
MasCDS.EnableControls;
DetCDS.EnableControls;
Screen.Cursor := crDefault;
end;
end;
//--------------------------------
;-(