About handle transaction
How we handle transactions in asp.net?
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
SenthilkumarPosted Feb 29, 2012, 5:37 AM
//Begin Transaction
SqlTransaction trans = conn.BeginTransaction("RemoveProducts");
try
{
//Delete Product
SqlCommand cmd = new SqlCommand("", conn, trans);
cmd.CommandText = "Delete from Products where ID=5";
cmd.ExecuteNonQuery();
trans.Commit();
}catch(SqlException sqlex)
{
transs.RollBack();
}