执行检索 7000+ 的存储过程时出现超时过期错误数据
我编写了一个存储过程,它检索超过 7000 行。在我的 VB.NET winforms 应用程序中执行存储过程时,我收到如下错误。
超时已过。操作完成之前超时时间已过,或者服务器没有响应。
我用谷歌搜索并尝试使用这些没有用的代码行。
sqlCmd.CommandTimeout = 0
sqlCmd = New SqlCommand("waitfor delay '00:00:60'")
请帮我解决这个问题。
I have written a stored procedure which retrieves more than 7000 rows. While executing the stored procedure in my VB.NET winforms application, I'm getting an error like as follows.
Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.
I googled and tried like using these lines of codes which wasn't useful.
sqlCmd.CommandTimeout = 0
sqlCmd = New SqlCommand("waitfor delay '00:00:60'")
Please help me with this.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您可能会在多个地方遇到超时。有些事情要尝试。
There are multiple places you can be experiencing a timeout. Some things to try.
您应该增加 commandTimeOut 而不是将其设置为 0。
尝试将值设置为 60,这意味着 1 分钟。
You should increase the commandTimeOut and not put it 0.
Try to put the value 60, which means 1 minute.
不建议将超时设置为 0。剩下的答案只是增加限制,但是..
增加超时就像一个创可贴解决方案。如果您有更长的查询怎么办?您会再次增加超时吗?
要解决此问题,请参阅我的答案。
超时已过。操作完成前超时时间已过或服务器未响应
It is not advisable to set your timeout to 0. The remaining answer would be only to increase the limit BUT..
Increasing the timeout is like a band-aid solution. What if you have a longer query? Will you just increase the timeout again?
To solve this, please refer to my answer here..
Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding