Table of Contents

Method CreateTextCommand

Namespace
Open.Database.Extensions
Assembly
Open.Database.Extensions.Core.dll

CreateTextCommand(IDbConnection, string, int)

Creates a text IDbCommand from a connection.

public static IDbCommand CreateTextCommand(this IDbConnection connection, string commandText, int secondsTimeout = 60)

Parameters

connection IDbConnection

The connection to create the command from.

commandText string

The command text to use.

secondsTimeout int

The number of seconds to wait before the command times out. The default is 60 seconds.

Returns

IDbCommand

A new IDbCommand 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

ArgumentNullException

connection or commandText is null.

ArgumentException

commandText is empty or white space.

CreateTextCommand(DbConnection, string, int)

Creates a text DbCommand from a DbConnection.

public static DbCommand CreateTextCommand(this DbConnection connection, string commandText, int secondsTimeout = 60)

Parameters

connection DbConnection

The connection to create the command from.

commandText string

The command text to use.

secondsTimeout int

The number of seconds to wait before the command times out. The default is 60 seconds.

Returns

DbCommand

A new DbCommand 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

ArgumentNullException

connection or commandText is null.

ArgumentException

commandText is empty or white space.