[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Problem with SQL  transaction

Posted on 2009-04-06
2
Medium Priority
?
269 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

In this article I will describe the Backup & Restore method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…

656 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