System.Data.SqlClient Namespace SqlParameter Class
Initializes a new instance of the SqlParameter class with the parameter name and value.
[ VB ]
Overloads Public Sub New ( _
ByVal name As String, _
ByVal value As Object _
)
[ C# ]
public SqlParameter (
string name,
object value
);
[ C++ ]
public: SqlParameter (
String* name,
Object value
);
[ JScript ]
public function SqlParameter (
name : String,
value : Object
);
- name
- The name of the parameter to map.
- value
- The value of the new SqlParameter object.
When you specify an Object in the value parameter, the SqlDbType is inferred from the .NET Framework type of the Object.
The following example initializes an SqlParameter using this constructor and sets some of its properties.
public void CreateSqlParameter ( ) {
SqlParameter myParam = new SqlParameter ( "@Category", "Beverages" );
myParam.Direction = ParameterDirection.Output;
}
Public Sub CreateSqlParameter ( )
Dim myParam As New SqlParameter ( "@Category", "Beverages" )
myParam.Direction = ParameterDirection.Output
End Sub |
|
C# |
VB |
SqlParameter Members SqlParameter Constructor Overload List