Subject RE: [IBO] Re: How do I make ClientDatasets with master/detail relationships work right?
Author IBO Support List
Mason,

I don't use them extensively, but I do have some sample applications and I
do intend them to work 100%. Will you please make a sample app of your
problem so that I can see what is going on?

Jason

-----Original Message-----
From: IBObjects@yahoogroups.com [mailto:IBObjects@yahoogroups.com] On Behalf
Of masonwheeler
Sent: 01 November 2012 11:16 AM
To: IBObjects@yahoogroups.com
Subject: [IBO] Re: How do I make ClientDatasets with master/detail
relationships work right?



--- In IBObjects@yahoogroups.com, "masonwheeler" <masonwheeler@...> wrote:
>
> I just ran into a bit of a problem. I've got two TIBOTables, let's call
them M and D. The database table for D has a foreign key that points to M's
table.
>
> I have two TClientDataset instances, one linked to M and one linked to D,
through providers. (Let's call them cdsM and cdsD.) The providers both
have ResolveToDataset set to true, which means that when I call
ApplyUpdates, the updates should only be sent to the TIBOTable dataset and
not to the database.
>
> Everything works fine until I try to delete a record in cdsM that has
records in cdsD pointing to it. I deleted those as well, but when I run the
following code:
>
> cdsM.ApplyUpdates(0);
> cdsD.ApplyUpdates(0);
>
> ...which should apply the updates back to the datasets and not to the
database, I get a foreign key violation from the database. (And if I were
to apply the updates in the opposite order, it would error on inserts to M
instead. And this is a UI-driven operation, where it's quite possible to
get both inserts and deletes in the same batch of updates.)
>
> How do I set this up so that I can apply both inserts and deletes from the
client datasets, and the TIBOTables will delay passing the SQL on to the
database until it has all the necessary information it needs to handle
things in the proper order? (Delete from D before M, insert to M before D.)

...anyone? I can't be the only one who's ever tried to use IBO with client
datasets.



------------------------------------

___________________________________________________________________________
IB Objects - direct, complete, custom connectivity to Firebird or InterBase
without the need for BDE, ODBC or any other layer.
___________________________________________________________________________
http://www.ibobjects.com - your IBO community resource for Tech Info papers,
keyword-searchable FAQ, community code contributions and more !
Yahoo! Groups Links