{1314myCommand.CommandText="Insert into Region (RegionID, RegionDescription) VALUES (100,"Description")";1516myCommand.ExecuteNonQuery();1718myCommand.CommandText="Insert into Region (RegionID, RegionDescription) VALUES (101,"Description")";1920myCommand.ExecuteNonQuery();2122myTrans.Commit();//提交事务2324Response.Write("Both records are written to database.两次插入数据都成功");2526}2728catch(Exception e)2930
{3132myTrans.Rollback();//回滚事务3334Response.Write(e.ToString());3536Response.Write("Neither record was written to database.没有一次插入数据成功");3738}3940finally4142