複製代碼 代碼如下:
///
/// 批量執行SQL語句
///
///SQL語句數組
///SQL參數對象數組
///
public static Int32 ExecuteSqls(String[] Sqlstr, Listparam)
{
String ConnStr = GetSqlConnection();
using (SqlConnection conn = new SqlConnection(ConnStr))
{
SqlCommand cmd = new SqlCommand();
SqlTransaction tran = null;
saction = tran;
try
{
();
tran = nTransaction();
ection = conn;
saction = tran;
Int32 count = th;
for (Int32 i = 0; i < count; i++)
{
andText = Sqlstr[i];
ange(param[i]);
uteNonQuery();
}
it();
return 1;
}
catch
{
back();
return 0;
}
finally
{
ose();
e();
}
}
}