try
{
using (System.Transactions.TransactionScope ts = newSystem.Transactions.TransactionScope())
{
using(SqlConnection Conn = new SqlConnection(connString))
{
Conn.Open();
SqlCommandsqlcmd = new SqlCommand("insert into orders(classid) VALUES('50')",Conn);
sqlcmd.ExecuteNonQuery();
sqlcmd = new SqlCommand("insert into rankorder(orderid)VALUES(50)", Conn);
sqlcmd.ExecuteNonQuery();
}
ts.Complete();
}
}
catch(SqlException EX)
{
string s =string.Format("错误号:{0},错误信息:{1}",EX.Number,EX.Message);
MessageBox.Show(s);
}