Method CreateStoredProcedureCommand
- Namespace
- Open.Database.Extensions
- Assembly
- Open.Database.Extensions.MSSqlClient.dll
CreateStoredProcedureCommand(SqlConnection, string, int)
Creates a stored procedure SqlCommand from a connection.
public static SqlCommand CreateStoredProcedureCommand(this SqlConnection connection, string procedureName, int secondsTimeout = 60)
Parameters
connectionSqlConnectionThe connection to create the command from.
procedureNamestringThe stored procedure name.
secondsTimeoutintThe number of seconds to wait before the command times out. The default is 60 seconds.
Returns
- SqlCommand
A new SqlCommand that the caller owns and disposes. It is not associated with a transaction.
Remarks
The connection is not opened by this method; open it (see EnsureOpen(IDbConnection)) before executing the command.
Exceptions
- ArgumentException
procedureNameis empty or white space.- ArgumentNullException
connectionorprocedureNameis null.