- 相關(guān)推薦
SQLserver找出執(zhí)行慢的SQL語句
復(fù)制代碼 代碼如下:
///
/// 批量執(zhí)行SQL語句
///
///SQL語句數(shù)組
///SQL參數(shù)對象數(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語句】相關(guān)文章:
sql語法大全03-23
Sql認(rèn)證考試內(nèi)容06-08
MySQL導(dǎo)出導(dǎo)入SQL文件命令方法06-29
關(guān)于JDBC連接SQL2000的詳細(xì)流程07-16
電腦開機(jī)慢怎么處理07-19
如何提高執(zhí)行力01-30
慢寫人物畫的基本方法步驟12-09
員工執(zhí)行力怎么提高02-10
高中公開課《聲聲慢》優(yōu)秀教案04-09
網(wǎng)速慢及路由器故障處理方法02-07