string myconnstring = ".....";
SqlConnection myconn = new SqlConnection (myconn);
myconn.open;
SqlTransaction mytrans = myconn.BeginTransaction();//指定开始数据库事务对象
SqlCommend mycmd = new SqlCommend ("sql语句",myconn);
myconn.Transaction = mytrans ;//获取或设置在其中执行的SqlCommend的事务
myconn.ExecuteNonQuery();
mytrans.Commit(); //提交数据事务
myconn.close();