我有一個SQL存儲過程,這是我從我的asp.net(2.0)代碼使用 sqlCom.ExecuteNonQuery()調用,但它tooks約60到100秒完成,而我執行相同的SP從SQL查詢工具運行3到4秒。
請幫忙。
編輯 - 代碼註釋:
public int ExecuteNonQuery(string strSpName, DbParameter[] parameterValues)
{
CreateConnection();
SqlCommand sqlCom = new SqlCommand();
if (strSpName == null || strSpName.Length == 0)
throw new ArgumentNullException("strSpName");
int i = 0;
sqlCom.Connection = _sqlConn;
if (_blnIsTransEnabld == true)
sqlCom.Transaction = _sqlT;
sqlCom.CommandType = System.Data.CommandType.StoredProcedure;
sqlCom.CommandText = strSpName;
sqlCom.CommandTimeout = _sqlConn.ConnectionTimeout;
return sqlCom.ExecuteNonQuery();
}
HI, 我在執行SQL查詢的同時,在3秒鐘內從C#代碼調用同一個sp並完成同樣的sp時發生了SP執行問題 – 2010-07-12 11:01:04
請發佈執行存儲過程的代碼。 – 2010-07-12 11:02:42
public int ExecuteNonQuery(string strSpName,DbParameter [] parameterValues) { CreateConnection(); SqlCommand sqlCom = new SqlCommand(); if(strSpName == null || strSpName.Length == 0)throw new ArgumentNullException(「strSpName」); int i = 0; sqlCom.Connection = _sqlConn;如果(_blnIsTransEnabld == true) sqlCom.Transaction = _sqlT; sqlCom.CommandType = System.Data.CommandType.StoredProcedure; sqlCom.CommandText = strSpName; sqlCom.CommandTimeout = _sqlConn.ConnectionTimeout; return sqlCom.ExecuteNonQuery(); – 2010-07-12 11:09:36