Reputation: 71
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.
Upvotes: 0
Views: 6212
Reputation: 533
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..
Upvotes: 0
Reputation: 29976
There are multiple places you can be experiencing a timeout. Some things to try.
Upvotes: 1
Reputation: 7632
You should increase the commandTimeOut and not put it 0.
Try to put the value 60, which means 1 minute.
Upvotes: 0