About handle transaction
How we handle transactions in asp.net?
1 Answer
Know the answer? Post it. Somebody with the same question will find it here.
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend4days leftRegister
SenthilkumarRank #387 · 6.5K reputationPosted Feb 29, 2012, 12:37 AM EST
//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();
}