Page 1 of 1

The transactions operation cannot be performed

PostPosted: Tue Jan 10, 2023 4:24 am
by sameermoin
Hi Everyone,

I am using a StockLevelChanged event in Application Manager. One change I did is I make it Asynchronous and I am just calling one SQL query for getting the quantity left for the InventoryItem. Now, when I am copying an Inventory Item from the inventory maintenance form it's throwing me an error saying: The transaction operation cannot be performed because there are pending requests working on this transaction..

It is just a demonstrated code so please ignore the query, I am doing other asynchronous things after getting the query result.

Error screenshot
InventoryItem.jpg


I also attached the plugin in the attachment.
Plugin stocklevel.xml
(24.78 KiB) Downloaded 458 times

Re: The transactions operation cannot be performed  Topic is solved

PostPosted: Tue Jan 10, 2023 10:11 am
by SBarnes
The first thing I would try is changing line 52 to


Code: Select all
 using (var sqlCommand = new SqlCommand(query, manager.Database.SQLConnection))


As you don't need a transaction to read data, if this doesn't work the other option would be to use ORMLite which is part of ServiceStack to execute the query and go around the problem.

The reason you are getting the issue you are getting involved in the transaction that Jiwa has started as part of what is is doing for inventory by referencing manager.Database.SQLTransaction when you probably don't need to.

Re: The transactions operation cannot be performed

PostPosted: Wed Jan 11, 2023 2:01 am
by sameermoin
Thanks, Stuart for your answer. I use the transaction to illustrate my issue. Let me check with ORMLite.