Reputation: 1668
I see a lot of questions about setting a timeout value but none asking about an infinite timeout. We have a stored proc that can take over an hour to stage data for a process. So I was thinking it would be better to just set the CommandTimeout to never timeout. I know there are issues with this approach.
I was reading the MS documentation for CommandTimeout and it doesn't really say anything regarding never timing out so I'm thinking one approach is to just set an arbitrarily high number. Or maybe go with double the average processing time.
Upvotes: 1
Views: 2435
Reputation: 692
So according to SqlCommand.CommandTimeout you can accomplish this by setting it to 0. On the documentation you linked, it says it throws ArgumentException
if the timeout is less than 0. Have you tried using 0 as the timeout?
Upvotes: 2