How to set CommandTimeout

Dr. Rajesh Rolen picture Dr. Rajesh Rolen · May 9, 2012 · Viewed 15.1k times · Source

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