- 相關推薦
SQLserver找出執行慢的SQL語句
復制代碼 代碼如下:
///
/// 批量執行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;
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找出執行慢的SQL語句】相關文章:
執行sql原理l分析05-12
oracle的sql語句01-21
SQL查詢語句大全10-24
SQL語句的理解原則10-05
mysql SQL語句積累參考10-02
sql語句的各種模糊查詢08-25
Oracle的sql語句模擬試題及答案10-12
SQL語句中的正則表達示07-28