This is a question better posted to
microsoft.public.dotnet.framework.adonet, but you already answered your own
question. If it's timing out on a lengthy operation, then the solution is
to increase the timeout to a value that will exceed the longest that this
operation could take.
This is done by setting the CommandTimeout property of your SqlCommand
object. I believe the default is 30 seconds.
--Bob
"wolf" <xiaozhimin1978 (AT) 163 (DOT) com> wrote
Quote:
When I try to restore a database via SqlCommand.ExecuteNoneQuery(), a
SqlException exception thrown. The message about the exception is:
Timeout expired. The timeout period elapsed prior to completion of the
operation or the server is not responding.
But the same commandtext run correctly in the Sql Query Analyzer.
What shall I do to run this command correctly?
Thanks! |