Page 1 of 1

Transaction problem...new to using IBDAC

Posted: Mon 01 Feb 2010 22:55
by monkeymynd
Hi All,

It appears as if IBCConnection automatically controls transactions. I'm wondering how to explicitly call a transaction in the following instance.

I have a point of sale module. When I enter the POS module, I open queries to allow users to pick items from the inventory, to select a list of active salespeople, etc. From what I've read here in the forums, simply opening a query will cause the IBCConnection to start a transaction.

My problem is that I need the data in those datasets to be active, but when I go to post the POS items to the database, I want to explicitly begin a transaction that I can rollback in case there is a problem. For instance, I need to post the items to my client_transactions table, possibly update client data if there is a client associated with the POS sale, write data to my receipt table, etc.

I need to wrap a transaction around these specific actions, only, in case something bombs out. At the moment, when I call the MyIBCConnection.StartTransaction before I get ready to post out the sale, it errors because there is already a transaction in progress due to the opening of the datasets.

Can anyone tell me the proper way to do this with IBDAC?

Thanks in advance for any responses.

Re: Transaction problem...new to using IBDAC

Posted: Tue 02 Feb 2010 12:50
by upscene
monkeymynd wrote:Hi All,

It appears as if IBCConnection automatically controls transactions. I'm wondering how to explicitly call a transaction in the following instance.

I have a point of sale module. When I enter the POS module, I open queries to allow users to pick items from the inventory, to select a list of active salespeople, etc. From what I've read here in the forums, simply opening a query will cause the IBCConnection to start a transaction.

My problem is that I need the data in those datasets to be active, but when I go to post the POS items to the database, I want to explicitly begin a transaction that I can rollback in case there is a problem. For instance, I need to post the items to my client_transactions table, possibly update client data if there is a client associated with the POS sale, write data to my receipt table, etc.

I need to wrap a transaction around these specific actions, only, in case something bombs out. At the moment, when I call the MyIBCConnection.StartTransaction before I get ready to post out the sale, it errors because there is already a transaction in progress due to the opening of the datasets.

Can anyone tell me the proper way to do this with IBDAC?

Thanks in advance for any responses.
Use additional TIBCTransaction components and attach your TIBCQuery/whatever component to that one instead.

Posted: Thu 04 Feb 2010 14:59
by monkeymynd
Thank you...that worked perfectly.

Posted: Fri 03 Dec 2010 00:49
by amiller29au
Just converted it IBDac from IBObjects and I'm experiencing the same issue, the Transaction is Active with the TIBCQuery is opened.

What does this mean?

Use additional TIBCTransaction components and attach your TIBCQuery/whatever component to that one instead.

Posted: Mon 06 Dec 2010 10:44
by Dimon
This is a peculiarity of the InterBase server. It requires a transaction to work with a dataset. If you close the transaction, the dataset will be also closed.