CommandTimeout

A

Andrew Robinson

Is there any way to set the CommandTimeout within the connection string as
opposed to setting the property on the SQL Command Object which defaults to
30 seconds.

Please note that I am not talking about the connection timeout property that
is definately part of the connection string.

Thanks for any help.

Andy
 
W

WenYuan Wang

Hi Andy,

First of all, I'd like to confirm my understanding of your issue.
According to your description, I understand that you want to know whether
there is a way to set the CommandTimeout within the connection string.
If I misunderstood anything here, please don't hesitate to correct me.

As far as I know, I'm afraid we can *not* set the CommandTimeout in the
connection string.
The CommandTimeout is the property of DataCommand, and the default value is
30 seconds.
The connection string is used to connect the database. It is not related to
DataCommand.
There is no option which we can use to set the timeout of DataCommand.

If you want to set the CommandTimeout property of DataCommand, I would like
to suggest you using the following statement.
SqlCommand.CommandTimeout=30;

If there is anything I can help with, please feel free to reply me here. We
will follow up.
I'm glad to work with you.
Sincerely,
Wen Yuan
 
W

WenYuan Wang

Hi Andy,

Just want to check whether there is anything we can help with.
Please feel free to reply me here, and we will follow up.
I'm glad to work with you.

Have a good day,
Best regards,
Wen Yuan
 

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