Solved

sql server vb .net how to rollback

Posted on 2009-05-05
1
349 Views
Last Modified: 2013-12-25
Hi,
I have a database application, I used sqlconnection, sqldataadapter and dataset. I have all the functions (update,delete,insert) but I want to have a button too to cancel changes eg. when updating and it is wrong or when inserting and want to cancel.
0
Comment
Question by:kyriakos70
1 Comment
 
LVL 6

Accepted Solution

by:
openshac earned 500 total points
Comment Utility

There's an example here of how to use the commit and rollback of the transaction object:
http://www.experts-exchange.com/Programming/Languages/.NET/Visual_Basic.NET/Q_21590938.html

Maybe the easiest way for you is to use a BackgroundWorker object.  When you click the "Cancel" button set a flag to true/false;

In the RunWorkerCompleted event of the BackgroundWorker object you want to test the value of the flag and decide to commit or rollback the transaction.

If you need any more info please postback.
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

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

771 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

10 Experts available now in Live!

Get 1:1 Help Now