asp.net 2.0 中通过 SqlHelper 命令超时
command timeout through SqlHelper in asp.net 2.0
我有一个适用于 asp.net 2.0 的应用程序,我想增加命令超时,但它正在使用 sqlHelper class;
dsData = SqlHelper.ExecuteDataset(connectionstring, System.Data.CommandType.StoredProcedure, spName, m_SqlParam)
我找不到这方面的任何示例,或者我应该更改 SqlHelper 代码吗?
您可以像下面那样使用 SqlCommand.CommandTimeout
属性
SqlCommand command = new SqlCommand(queryString, connection);
command.CommandTimeout = 20;
您的 SqlHelper
看起来像是 SqlCommand
的自定义包装器(或)存储库 class。在这种情况下,您可以更改 SqlHelper
class 中的代码库(或者)让您的 ExecuteDataset()
方法接受另一个超时参数
我有一个适用于 asp.net 2.0 的应用程序,我想增加命令超时,但它正在使用 sqlHelper class;
dsData = SqlHelper.ExecuteDataset(connectionstring, System.Data.CommandType.StoredProcedure, spName, m_SqlParam)
我找不到这方面的任何示例,或者我应该更改 SqlHelper 代码吗?
您可以像下面那样使用 SqlCommand.CommandTimeout
属性
SqlCommand command = new SqlCommand(queryString, connection);
command.CommandTimeout = 20;
您的 SqlHelper
看起来像是 SqlCommand
的自定义包装器(或)存储库 class。在这种情况下,您可以更改 SqlHelper
class 中的代码库(或者)让您的 ExecuteDataset()
方法接受另一个超时参数