0

In webapplication, I put

sqlcommand.CommandTimeout=0;

Is this statement is recommended or not [good progamming style], or which one is good if it is not good?

1
  • If you're ready to wait forever ... Commented Oct 13, 2011 at 8:52

1 Answer 1

2

From the SqlCommand.CommandTimeout documentation:

A value of 0 indications no limit, and should be avoided

It could cause the request and the thread processes it to hang indefinitely. This is a waste of resources if nothing else.

It would also make it harder to identify if you have commands that are not completing in a reasonable time.

is this statement is recommended or no

Not.

Sign up to request clarification or add additional context in comments.

1 Comment

+1 Overriding the command timeout is somewhat of the last resort - if the problem can already be tracked down to a single command it should be possible to find a better solution.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.