System.Data.SqlClient Namespace SqlParameter Class
Initializes a new instance of the SqlParameter class with the parameter name, data type, width, source column name, parameter direction, numeric precision, and other properties.
[ VB ]
Overloads Public Sub New ( _
ByVal parameterName As String, _
ByVal dbType As SqlDbType, _
ByVal size As Integer, _
ByVal direction As ParameterDirection, _
ByVal isNullable As Boolean, _
ByVal precision As Byte, _
ByVal scale As Byte, _
ByVal srcColumn As String, _
ByVal srcVersion As DataRowVersion, _
ByVal value As Object _
)
[ C# ]
public SqlParameter (
string parameterName,
SqlDbType dbType,
int size,
ParameterDirection direction,
bool isNullable,
byte precision,
byte scale,
string srcColumn,
DataRowVersion srcVersion,
object value
);
[ C++ ]
public: SqlParameter (
String* parameterName,
SqlDbType dbType,
int size,
ParameterDirection direction,
bool isNullable,
unsigned char precision,
unsigned char scale,
String* srcColumn,
DataRowVersion srcVersion,
Object* value
);
[ JScript ]
public function SqlParameter (
parameterName : String,
dbType : SqlDbType,
size : int,
direction : ParameterDirection,
isNullable : Boolean,
precision : Byte,
scale : Byte,
srcColumn : String,
srcVersion : DataRowVersion,
value : Object
);
- parameterName
- The name of the parameter.
- dbType
- One of the SqlDbType values.
- size
- The width of the parameter.
- direction
- One of the ParameterDirection values.
- isNullable
- true if the value of the field can be null; otherwise, false.
- precision
- The total number of digits to which Value is resolved.
- scale
- The number of decimal places to which Value is resolved.
- srcColumn
- The name of the source column.
- srcVersion
- One of the DataRowVersion values.
- value
- An Object that is the value of the SqlParameter.
The following example initializes an SqlParameter using this constructor and displays the ParameterName.
public void CreateSqlParameter ( ) {
SqlParameter myParam = new SqlParameter ( "@Description", SqlDbType.VarChar,
100, ParameterDirection.Output, true, 0, 0, "Description",
DataRowVersion.Current,"garden hose" );
Response.Write ( myParam.ToString ( ) );
}
Public Sub CreateSqlParameter ( )
Dim myParam As New SqlParameter ( "@Description", SqlDbType.VarChar, _
100, ParameterDirection.Output, True, 0, 0, "Description", _
DataRowVersion.Current, "garden hose" )
Response.Write ( myParam.ToString ( ) )
End Sub |
|
C# |
VB |
SqlParameter Members SqlParameter Constructor Overload List
|
|