如何在asp.net C#中更改Sql Helper默认时间。
问题描述:
如何在asp.net C#中更改Sql Helper默认时间。
在asp.net中显示超时错误但是程序运行正确地在Sql Server
How to change Sql Helper Default time in asp.net C#.
Showing Timeout Error in asp.net but Procedure run properly in Sql Server
答
可能你不能 - 或者至少不是真正有用的方式。
你可能能够通过更改SqlComamnd的CommandTimeout属性来更改它: https://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlcommand.commandtimeout%28v=vs.110%29.aspx?f = 255& MSPPError = -2147217396 [ ^ ]
但......如果你的命令超时,那么你可能需要查看你的查询并努力改进那个ra而不是给它更多的时间。延长超时可能允许它完成(如果您的托管服务没有它自己的覆盖限制,有些会这样做)但如果您的页面长时间没有响应等待SQL完成处理,则用户可能会假设你死了,去其他地方......
Probably, you can't - or at least not in a really useful way.
You may be able to change it by altering the CommandTimeout property of the SqlComamnd: https://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlcommand.commandtimeout%28v=vs.110%29.aspx?f=255&MSPPError=-2147217396[^]
But...if your command is timing out, then you probably need to look at your query and work on improving that rather than giving it more time. Extending the timeout may allow it to finish (if your hosting service doesn't have it's own overriding limits, and some do) but if your page is unresponsive for a long time waiting for your SQL to finish processing, the user is likely to assume you are dead and go elsewhere...