asp.net – 使用sql helper时出现超时问题(Microsoft.Applicatio
发布时间:2020-12-16 09:50:30 所属栏目:asp.Net 来源:网络整理
导读:我在处理长sql查询时遇到超时问题,对于长查询超时的数据集是: static public DataSet Getxxxx(Guid xxxx){ DataSet ds = SqlHelper.ExecuteDataset(ConnectionString,CommandType.StoredProcedure,"GetAllxx",new SqlParameter("@productxx",productxx)); r
我在处理长sql查询时遇到超时问题,对于长查询超时的数据集是:
static public DataSet Getxxxx(Guid xxxx) { DataSet ds = SqlHelper.ExecuteDataset(ConnectionString,CommandType.StoredProcedure,"GetAllxx",new SqlParameter("@productxx",productxx)); return ds; } 我在哪里可以设置超时,我使用的是Microsoft应用程序块2.0版. 解决方法
数据访问应用程序块SqlHelper已经是
phased out in favour of ‘Database’,因此您需要显式创建DbCommand并将其传递给Database.ExecuteDataSet.然后,您可以设置
CommandTimeout property,以覆盖默认值30秒.例如这会将超时设置为200秒:
using (DbCommand command = this.Database.GetStoredProcCommand("GetAllxx")) { Database.AddInParameter(command,"@productxx",DbType.Int32,productxx); command.CommandTimeout = 200; return Database.ExecuteDataSet(command); } (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
相关内容
- asp.net-mvc – ASP.NET MVC:确保用户始终拥有会话变量集
- 深入理解Asp.Net中WebForm的生命周期
- Asp.net Response.Write在ascx / aspx文件中
- asp.net – 如何防止开放重定向攻击?
- asp.net-mvc – UpdateModel和TryUpdateModel
- Asp.Net Core中WebSocket绑定的方法详解
- Asp.net程序添加代理
- asp.net – CA1305:int.Parse(String)
- asp.net – 当我将’启用32位应用程序’更改为False时,为什
- ASP.Net OData在LB中通过SSL终止失败
推荐文章
站长推荐
- asp.net-mvc – 使用ASP.NET MVC进行消防和遗忘
- asp.net – 界面的好处是什么意味着某种实现?
- asp.net-mvc – MVC – 视图中的多个模型
- ASP.NET MVC 4的Windows身份验证 – 它如何工作,
- asp.net-mvc – Razor MVC4 Url.Action无效
- 一个ASP.Net页面中的多个reCAPTCHA
- asp.net – 页面控制
- asp.net-mvc-3 – 使用Razor在Telerik MVC3网格中
- 获取一些401 – 访问我的ASP.NET MVC网站时未经授
- asp.net-mvc – 从/到POCO对象的knockoutjs映射
热点阅读