Solved

Problem with SQL  transaction

Posted on 2009-04-06
2
265 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 500 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

Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

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.
This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

807 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