日期:2011-10-01 浏览次数:20572 次
/// <summary>
/// 执行sql语句(事务)
/// </summary>
///
public bool Cmdsql(string[] str)
{
GetOconn();
myTrans =Oconn.BeginTransaction();
Ocmd=new OleDbCommand();
Ocmd.Connection=Oconn;
Ocmd.Transaction=myTrans;
try
{
for(int i=0;i<str.Length;i++)
{
Ocmd.CommandText=str[i];
Ocmd.ExecuteNonQuery();
}
myTrans.Commit();
CloseOconn();
return true;
}
catch
{
myTrans.Rollback();
return false;
}
}