?
Solved

Problem with SQL  transaction

Posted on 2009-04-06
2
Medium Priority
?
270 Views
Last Modified: 2012-05-06
Hello,

I have a set of queries which are being executed on a page and on click of submit button I am doing all the required updates and finishing it off... My Problem is.. If someone closes the page before clicking on submit, Then my table becomes incomplete... And it creates a lot of problems...

So i thought i would using SqlTransaction, But in that the table is getting locked, and i cannot access the table for quite some time...
So please help me resolve this issue, If there is an alternative for SqlTransaction please let me know..

Thanks in advance,
Priya

0
Comment
Question by:Priyadarshni
2 Comments
 
LVL 12

Expert Comment

by:udaya kumar laligondla
ID: 24075306
instead use intermediate storage to store the information before saving to the table. for ex
Create a temp table as #temp+SessionID which will be unique. copy all the initial data in to the table. on click of submit begin transaction and copy the data from temp table to main table then commit the trans if no error. drop the temp table
you will have to clear the temp tables if the sessions are terminated in the middle.
0
 
LVL 57

Accepted Solution

by:
Raja Jegan R earned 1500 total points
ID: 24075328
If you are having a set of queries to be covered within a transaction, then you can Create a Procedure and put all the set of queries within that procedure. Provide logics to the Procedure on when to Rollback or commit a transaction.

Above will help you to avoid Transactions spanning across when the Page is closed in the middle.
If Creating a procedure will not be fruitful in your scenario, then try the ones listed below:

http://books.google.co.in/books?id=IykBBnWqyugC&pg=PA504&lpg=PA504&dq=alternative+to+Sql+Transaction&source=bl&ots=Kb7xAfcqy8&sig=jZUr9OFdLHr1xtABDhB676c-pvY&hl=en&ei=usDZScX5KKbg6gPi26DkCg&sa=X&oi=book_result&ct=result&resnum=3
0

Featured Post

Veeam and MySQL: How to Perform Backup & Recovery

MySQL and the MariaDB variant are among the most used databases in Linux environments, and many critical applications support their data on them. Watch this recorded webinar to find out how Veeam Backup & Replication allows you to get consistent backups of MySQL databases.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question