使用 sql helper(Microsoft.ApplicationBlocks.Data) 时出现超时问题
我在处理长sql查询时遇到超时问题,长查询超时的数据集是:
static public DataSet Getxxxx(Guid xxxx)
{
DataSet ds = SqlHelper.ExecuteDataset(ConnectionString, CommandType.StoredProcedure, "GetAllxx", new SqlParameter("@productxx", productxx));
return ds;
}
在哪里可以设置超时,我正在使用Microsoft应用程序块版本2.0。
I am having timeout issues when dealing with long sql queries, the Dataset which timesout for long queries is :
static public DataSet Getxxxx(Guid xxxx)
{
DataSet ds = SqlHelper.ExecuteDataset(ConnectionString, CommandType.StoredProcedure, "GetAllxx", new SqlParameter("@productxx", productxx));
return ds;
}
Where can i set timeout , I am using Microsoft application block version 2.0.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
数据访问应用程序块
SqlHelper
已已逐步淘汰,取而代之的是“数据库”,因此您需要显式创建DbCommand
并将其传递给Database.ExecuteDataSet
。然后,您可以设置 < code>CommandTimeout 属性,覆盖默认值 30 秒。例如,这将超时设置为 200 秒:The Data Access Application Block
SqlHelper
has been phased out in favour of 'Database', so you'll need to explicitly create aDbCommand
and pass it through toDatabase.ExecuteDataSet
. You can then set theCommandTimeout
property, to override the default of 30 seconds. e.g. this sets the timeout to 200 seconds: