System.Data.SqlClient Namespace SqlParameter Class
Sets or retrieves the SqlDbType of the parameter.
Script |
SqlParameter.SqlDbType [ = enumValue ] |
The property is read/write with a default value of NVarChar.
Use the SqlDbType property to specify or determine the SQL Server™ data type ( SqlDbType ) of a given parameter.
The data type of a SqlParameter determines the type and range of values that are accepted for the parameter. For example, if you define a parameter with a tinyint data type, only numeric values ranging from 0 to 255 are accepted. An error is returned if a stored procedure is executed with a value incompatible with the data type.
SqlDbType and DbType are linked. Setting the SqlDbType changes the DbType to a supported SqlDbType enum value.
The following example initializes an SqlParameter and sets some of its properties.
public void CreateSqlParameter ( ) {
SqlParameter myParam = new SqlParameter ( "@Description", SqlDbType.VarChar, 100 );
myParam.Direction = ParameterDirection.Output;
}
Public Sub CreateSqlParameter ( )
Dim myParam As New SqlParameter ( "@Description", SqlDbType.VarChar, 100 )
myParam.Direction = ParameterDirection.Output
End Sub |
|
C# |
VB |
SqlParameter Members