Edit

Share via


DbExtensions.AddParameter<T> Method

Definition

Creates and adds a new SQL parameter to the command.

public static void AddParameter<T> (this System.Data.IDbCommand command, string parameterName, T value, System.Data.ParameterDirection direction = System.Data.ParameterDirection.Input, int? size = default, System.Data.DbType? dbType = default);
static member AddParameter : System.Data.IDbCommand * string * 'T * System.Data.ParameterDirection * Nullable<int> * Nullable<System.Data.DbType> -> unit
<Extension()>
Public Sub AddParameter(Of T) (command As IDbCommand, parameterName As String, value As T, Optional direction As ParameterDirection = System.Data.ParameterDirection.Input, Optional size As Nullable(Of Integer) = Nothing, Optional dbType As Nullable(Of DbType) = Nothing)

Type Parameters

T

The type of the parameter.

Parameters

command
IDbCommand

The command to use to create the parameter.

parameterName
String

The name of the parameter.

value
T

The value of the parameter.

direction
ParameterDirection

The direction of the parameter.

size
Nullable<Int32>

The size of the parameter value.

dbType
Nullable<DbType>

the DbType of the parameter.

Applies to