Change default timeout

B

Bawa

Hi everyone,

Here's my problem. I have a big vb.net application with a lot of calls

to stored procs. I don't want to add the line "Command.commandTimeout
= 600" in front of each of these calls. So, the default timeout is set

to 30 seconds. I'm pratically sure that I canc change this 30 seconds
in a registry or in a file somewhere. I hope that Microsoft didn't
hard coded it in the class! My question: How can I change the default

command timeout in one shot for all my application.


Thanks a lot!


Bawa
 
M

Marina Levit [MVP]

The right way to go about doing this is to have a GetSqlCommand method (or
whatever command type you are using). This method would instantiate the
object, set the CommandTimeout property, and return it.

This would be the proper way to structure your application. Then, if you
ever need to set some other property on all your command objects, you would
do it in this method.

I don't know of any setting for something like this on a machine, and I
don't think it's necessary. Different applications would require different
timeouts, and a global setting like this wouldn't work well.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top