Home>

Create transactions directly with SQL statements, Of course it's nothing unusual, Good is good, just trouble.

See how to do it in c#:

sqltransaction tran=dbconn.begintransaction ();
cmdtmp.transaction=tran;
try
{
  cmdtmp.commandtext="delete from xxx";
  cmdtmp.executenonquery ();
  cmdtmp.commandtext="insert into xxx";
  cmdtmp.executenonquery ();
  tran.commit ();
}
catch (exception ex)
{
  tran.rollback ();
  throw ex;
}
finally
{
  tran.dispose ();
  cmdtmp.transaction=null;
}
c
  • Previous How to implement ASPNET GridView folding and stretching effect with jQuery
  • Next Introduction to the Object class in Java programming