- 相關(guān)推薦
SQLserver找出執(zhí)行慢的SQL語(yǔ)句
復(fù)制代碼 代碼如下:
///
/// 批量執(zhí)行SQL語(yǔ)句
///
///SQL語(yǔ)句數(shù)組
///SQL參數(shù)對(duì)象數(shù)組
///
public static Int32 ExecuteSqls(String[] Sqlstr, Listparam)
{
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 < count; 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();
}
}
}
【SQLserver找出執(zhí)行慢的SQL語(yǔ)句】相關(guān)文章:
用SQLSERVER查詢正在實(shí)行的SQL的方法08-31
執(zhí)行sql原理l分析05-12
oracle的sql語(yǔ)句01-21
SQL查詢語(yǔ)句大全10-24
SQL語(yǔ)句的理解原則10-05
mysql SQL語(yǔ)句積累參考10-02
sql語(yǔ)句的各種模糊查詢08-25
SQL語(yǔ)句中的正則表達(dá)示07-28