Method CreateTextCommand
- Namespace
- Open.Database.Extensions
- Assembly
- Open.Database.Extensions.MSSqlClient.dll
CreateTextCommand(SqlConnection, string, int)
Creates a text SqlCommand from a connection.
public static SqlCommand CreateTextCommand(this SqlConnection connection, string commandText, int secondsTimeout = 60)
Parameters
connectionSqlConnectionThe connection to create the command from.
commandTextstringThe command text to use.
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.
Exceptions
- ArgumentNullException
connectionorcommandTextis null.- ArgumentException
commandTextis empty or white space.