I'm receiving an error message:
System.Data.SqlClient.SqlException: Timeout expired.
I've traced this back to a command timeout which by default is set to 30 seconds. Sure enough, when profiled, completes (failed) at 30 seconds on the dot.
The easy answer would be to increase the CommandTimeout
value in the code. Here's the catch - I only have an executable file to work with.
The query being run is a stored procedure that runs between 18-26 seconds normally and recently has been bumping up into the 30+ second range. I've done everything I can to optimize the query which is a single ugly select on three tables with joins. This isn't really an option anyways as the dataset will continue to grow and will be a problem again in the future.
All advice I could find here and elsewhere on the net says the only place CommandTimeout
can be set is in the code after the connection is set up and there is no other way to adjust the command timeout.
I'm about ready to start decompiling the executable to try to override/set the default value of the command timeout..
Any suggestions on how I can non-programmatically increase the command timeout value, get the command Timeout value set easily or some other (hopefully) more sensible solution?
Thanks for your help!
ps - I've been reading SO for quite a while now. My reputation stinks because I always find the answer without having to post. You guys are awesome and I'm glad I finally found a way to get started!
The only way that you can change the command timeout is to update the code, if you don't have the source to the application I'm sorry to say that you are pretty much out of luck.
That is a value that is setup command-by-command, so anything external to the command will not impact it.