- 相关推荐
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