Hello Jiří,

I have been struggling with FbDataAdapter for years now (it goes back to
the days when Carlos was in charge), and I had finally given up and used
a hack to fix my problem; I've come across it again and I'd like to know
if there is a proper way to solve it.

Here is what I do:

- I create an FbDataAdapter based on a command :

    adapter = new FbDataAdapter (selectCommand);
    builder = new FbCommandBuilder (adapter);

- ... lots of stuff happens ...

- Later on, I set a transaction on the command object before calling
  the Update method of the adapter

    selectCommand.Transaction = transaction1;
    adapter.Update (dataSet);

This works fine. The transaction1 gets committed and disposed. Then, I
do some more modifications in the DataSet, which I want to persist, so
I do this again :

    selectCommand.Transaction = transaction2;
    adapter.Update (dataSet);

However, FbCommand.CheckCommand fails, telling me that the transaction
is no longer valid (indeed, the transaction associated with the update
command object is still transaction1, which has been disposed earlier).

The only way around this issue, for now, is this hack:

adapter.RowUpdating +=
    delegate (object sender, FbRowUpdatingEventArgs e)
    {
        e.Command.Transaction = activeTransaction;
    };

Is there some official means of getting the adapter to use the new
transaction when it refreshes its update command, other than my
current hack ?

Pierre



------------------------------------------------------------------------------
ThinkGeek and WIRED's GeekDad team up for the Ultimate 
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the 
lucky parental unit.  See the prize list and enter to win: 
http://p.sf.net/sfu/thinkgeek-promo
_______________________________________________
Firebird-net-provider mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/firebird-net-provider

Reply via email to