ODBCCommand Timeout RRS feed

  • Question

  • Hi all,

    Could any one describe the importance of the property "CommandTimeout" for the ODBCCommand. Does that indicate the waiting time before the database execution starts? In short if suppose CommandTimeout = "x" seconds, then the database operation related to the ODBCCommand will start only after "x" seconds?
    MSDN Repository says that setting it to "0" infers infinite waiting time. In order to avoid performance bottlenecks, can we set it to some small value (say between 1-5). Should i be cautious about any other things which can affect after setting it to small value?


    Wednesday, December 29, 2010 9:49 AM


  • Hello M Nair,


    Welcome to MSDN Forum and thank you for posting here.

    Based on my understanding about CommandTimeOut, I think I can explain some for you.

    All the objects of Connection and Command have the CommandTimeOut property. But they are all unique between in Connection objects and in Command objects. The default CommandTimeOut time is 30s, and as you said, if you set “0”, that means ADO will wait indefinitely until the execution is complete.

     However, it doesn’t mean the smaller, the better. Because we need some time to execute the command. If there is not enough time to execute the command, I think the result must be not you want to see. So you can make your program run efficiently by setting the right value.

    I hope this will help you. If anything is unclear, please free feel to let us know.


    Thank you for your understanding and support.

    I look forward to hearing from you.


    Best Regards,

    Jackie Sun [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Thursday, December 30, 2010 10:03 AM