SqlCommand object, what length of time for CommandTimeout?

后端 未结 5 1622
-上瘾入骨i
-上瘾入骨i 2021-01-03 19:58

How do I decide what length of time to use as a timeout when using an SqlCommand object?

On parts of the code I\'m working on (written by somebody else) I have:

5条回答
  •  被撕碎了的回忆
    2021-01-03 20:10

    This is in SECONDS and it depends entirely on how long the actual SQL command is likely to take.

    For example example, most of our commands run sproc's that should take no longer than 30 seconds to complete, however there are a couple that run for much longer, which means they have their own high valued timeouts.

    You'll need to profile how long on average your routine takes then adjust the timeout accordingly, and remember to leave room for variables like latency etc.

提交回复
热议问题