Surya sasidhar
Surya sasidhar

Reputation: 30293

Ado net command time out in property in sqlcommand?

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?

Upvotes: 0

Views: 731

Answers (1)

Richard
Richard

Reputation: 108975

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.

Upvotes: 2

Related Questions