I am using Microsoft.SqlServer.Management.Smo
.
My Code:
Server server = new Server(new ServerConnection( new SqlConnection(ConnectionString));
server.ConnectionContext.ExecuteNonQuery(script);
I want to set CommandTimeout
for it like we do with normal SQLCommand
Please tell me how to set CommandTimeout
for queries running through Microsoft.SqlServer.Management.Smo.Server
Try server.ConnectionContext.StatementTimeout
You can set command timeout using the SMO object as shown below:
Server server = new Server(new ServerConnection(new SqlConnection(ConnectionString));
server.ConnectionContext.StatementTimeout = 10800;
server.ConnectionContext.ExecuteNonQuery(script);
For more information on SMO object command timeout refer this link.
http://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlcommand.commandtimeout.aspx
how to set the query timeout from SQL connection string
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With