The SqlTransaction
class is an important class of .NET Framework. It ensures that a body of code will affect a Database or kept the same as previous (Rollback).
At first we should know about it's two most important method which will be used here. They are given below.
Commit() : It commits the transaction. It save changes made in Database during transaction. In simple term we can also say that it shows the end of transaction at that time.
Rollback() : It is used to rollback the transaction. It set the database in previous stage which was, before the begin of transaction.