Solved

Problem with SQL  transaction

Posted on 2009-04-06
2
260 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:udayakumarlm
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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

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.
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…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

706 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now