如何增加的时间在web.config中执行SQL查询 [英] How to increase time in web.config for executing sql query
问题描述
当我运行在Web应用程序中查询时,我得到一个空
值。直接在SQL Management Studio中相同的查询返回结果。
When I am running a query in web application, I'm getting a null
value. Same query directly in SQL Management Studio returns results.
我觉得现在的问题是超时。我怎样才能提高在Web应用程序中查询的执行时间?在我的web.config:的connectionString
,没有code超时。如果让我选择一个超时那里,这会不会影响我的系统的其他部分?
I think that the problem is a timeout. How can I increase the time for execution of query in web application? In my web.config : connectionstring
, there is no code for timeout. If I choose a timeout there, will that affect other parts of my system?
推荐答案
SQL Server有没有设置来控制在连接字符串中查询超时,而据我所知,这是对其他主要的数据库一样。但是,这并不像你所看到的问题:我希望看到引发异常
SQL Server has no setting to control query timeout in the connection string, and as far as I know this is the same for other major databases. But, this doesn't look like the problem you're seeing: I'd expect to see an exception raised
错误信息:System.Data.SqlClient.SqlException:超时过期。操作完成或服务器之前经过的超时时间没有响应。
Error: System.Data.SqlClient.SqlException: Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.
如果有真正是执行查询超时。
if there genuinely was a timeout executing the query.
如果这也变成是一个问题,您可以更改SQL Server数据库作为数据库本身的属性的默认超时;使用SQL Server管理这一点。
If this does turn out to be a problem, you can change the default timeout for a SQL Server database as a property of the database itself; use SQL Server Manager for this.
要确保查询的究竟的从Web应用程序,就像是直接运行的一个相同。使用分析器来验证这一点。
Be sure that the query is exactly the same from your Web application as the one you're running directly. Use a profiler to verify this.
这篇关于如何增加的时间在web.config中执行SQL查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!