The transactions operation cannot be performed  Topic is solved

Discussions relating to plugin development, and the Jiwa API.

The transactions operation cannot be performed

Postby sameermoin » Tue Jan 10, 2023 4:24 am

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 49 times
sameermoin
Regular Contributor
Regular Contributor
 
Posts: 75
Joined: Wed Jun 15, 2022 4:02 am
Topics Solved: 1

Re: The transactions operation cannot be performed  Topic is solved

Postby SBarnes » Tue Jan 10, 2023 10:11 am

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.
Regards
Stuart Barnes
SBarnes
Shihan
Shihan
 
Posts: 1619
Joined: Fri Aug 15, 2008 3:27 pm
Topics Solved: 175

Re: The transactions operation cannot be performed

Postby sameermoin » Wed Jan 11, 2023 2:01 am

Thanks, Stuart for your answer. I use the transaction to illustrate my issue. Let me check with ORMLite.
sameermoin
Regular Contributor
Regular Contributor
 
Posts: 75
Joined: Wed Jun 15, 2022 4:02 am
Topics Solved: 1


Return to Technical and or Programming

Who is online

Users browsing this forum: No registered users and 34 guests