OleDbCommand cmd = new OleDbCommand("", conn);
conn.Open();
OleDbTransaction tran = conn.BeginTransaction();
cmd.Transaction = tran;
try
{
foreach (string sql in values)
{
cmd.CommandText = sql;
cmd.ExecuteNonQuery();
}
tran.Commit();
return true;
}
catch (Exception)
{
tran.Rollback();
return false;
//MessageBox.Show(e.ToString(), "错误提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
finally
{
conn.Close();
}
本文转自黄聪博客园博客,原文链接:http://www.cnblogs.com/huangcong/archive/2010/03/26/1697093.html,如需转载请自行联系原作者