Perform transactions in .net, DOT NET Programming

How can we perform transactions in .NET?

The common sequence of steps that would be performed for developing a transactional application is as follows:

1)In the first step open a database connection by using the Open method of the connection object.

2)In the second begin a transaction by using the Begin Transaction method of the connection object. This method gives us with a transaction object that we will use later to commit or rollback the transaction. Keep in mind that changes caused by any queries executed before calling the Begin Transaction method will be committed to the database immediately after they execute. Now Set the Transaction property of the command object to the above mentioned transaction object.

3)In the third step execute the SQL commands by using the command object. We can use one or more command objects for this purpose, as long as the Transaction property of all the objects is set to a valid transaction object.

4)In the fourth step roll back or commit the transaction by using the Commit or Rollback method of the transaction object.

5)At last close the database connection.

Posted Date: 9/24/2012 5:08:51 AM | Location : United States







Related Discussions:- Perform transactions in .net, Assignment Help, Ask Question on Perform transactions in .net, Get Answer, Expert's Help, Perform transactions in .net Discussions

Write discussion on Perform transactions in .net
Your posts are moderated
Related Questions
How can we implement singleton pattern in .NET ? The Singleton pattern basically focuses on having one and only one instance of the object running. Lets take an e.g. a windows

Which template must you provide, in order to display data in a Repeater control? ItemTemplate.To display data in the ItemTemplate, declare one or more Web server controls and s

How to Enable ASP.NET polling? All our database side is configured in order to get the SQL Cache working in the ASP.NET side we require to do some configuration in the web.conf

What are Assemblies? Assembly is a single deployable unit that have information about the implementation of classes, structures and interfaces. It also keeps the information ab

What are types of compatibility in VB6 There are three possible project compatibility settings: No Compatibility Project Compatibility Binary Compatibility

What is the difference between thread and process?  Thread - is used to implement more than one program at a time. process - implements single program A thread is a path

to design a grid view and edit and delete the data


What is SQl injection? This is a Form of attack on the  database-driven Web site in which the attacker executes the unauthorized SQL commands by taking merits of insecure code

What is the difference between delegate and events? Actually events use delegates in the bottom. But they also add an extra layer on the delegates, hence forming the publisher