///
/// 批量执行SQL语句
/// ///
SQL语句数组
///
SQL参数对象数组
///
public static Int32 ExecuteSqls(String[] Sqlstr, List
param)
{
String COnnStr= GetSqlConnection();
using (SqlConnection cOnn= new SqlConnection(ConnStr))
{
SqlCommand cmd = new SqlCommand();
SqlTransaction tran = null;
cmd.Transaction = tran;
try
{
conn.Open();
tran = conn.BeginTransaction();
cmd.COnnection= conn;
cmd.Transaction = tran;
Int32 count = Sqlstr.Length;
for (Int32 i = 0; i {
cmd.CommandText = Sqlstr[i];
cmd.Parameters.AddRange(param[i]);
cmd.ExecuteNonQuery();
}
tran.Commit();
return 1;
}
catch
{
tran.Rollback();
return 0;
}
finally
{
cmd.Dispose();
conn.Close();
}
}
}