日期:2014-05-17 浏览次数:21127 次
//以下是事务设置
SqlConnection Conn = dba.GetConn();
Conn.Open();
SqlTransaction sqlTrans = Conn.BeginTransaction();
SqlCommand sqlComm = Conn.CreateCommand();
sqlComm.Connection = Conn;
sqlComm.Transaction = sqlTrans;
try
{
for (int i = 0; i <arrayList.Count; i++)
{
string strID = arrayList[i].ToString();
sqlComm.CommandText = "Update Booktable set ID = '"+ strID +"' Where book_ID = '200'";
sqlComm.ExecuteNonQuery();
}
sqlTrans.Commit();
}