Code Takes Time That Varies System To System
I am facing a problem for last 15 days. I have a code which contains a do-while loop and inside that there are 4 for loops. in each loop the following function is called. Public Fu
Solution 1:
I dont think you should use CommandTimeout=0. This will make your script wait indefinitely for a successful connection, even if that's never going to happen.
I'd advise to build in a retry loop, as you already did in your second solution. Only keep the CommandTimeout at a reasonable value.
Also, you should investigate why your connection is failing. Maybe your server has reached its maximum number of SQL connections? Maybe you can find extra useful information in your SQL server logs.
Post a Comment for "Code Takes Time That Varies System To System"