What is the difference between TransactionScope in dot net and Transaction in SQL
protected void Page_Load(object sender, EventArgs e)
{
int i = 0;
using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required))
{
i = 1;
}
Response.Write(i.ToString());
}
I get the value 1 displayed by Response.Write(). Why? scope.Complete wasnt executed. Hence the i value should rollback to 0;
Basically the same thing; TransactionScope is the newer .NET version and the recommened version to use if you are coding on ASPNET 2.0 upwards.
TransactionScope Class