SQL 事务
https://blog.csdn.net/xiaouncle/article/details/52891563
https://www.cnblogs.com/knowledgesea/p/3714417.html
https://blog.csdn.net/WuLex/article/details/81218516
http://www.cnblogs.com/yuan-jun/p/6505759.html
.NET 事务技术
http://www.cftea.com/c/2009/08/9TRLTZ5XH73N2DXE.asp
// cmdText = "insert into softVersion (id) values(3);insert into softVersion (id) values(4)";
public static int ExecuteTransaction(string connectionString, string cmdText)
{
int result = 0;
using (SqlConnection conn = new SqlConnection(connectionString))
{
using (TransactionScope ts = new TransactionScope())
{
conn.Open();
try
{
using (SqlCommand cmd = new SqlCommand(cmdText, conn))
{
cmd.ExecuteNonQuery();
}
ts.Complete();
result = 1;
}
catch (SqlException ex)
{
result = 0;
}
conn.Close();
return result;
}
}
}