SqlParameter
This class represents a parameter for a stored procedure or
parameterized query. For information about the basic
SqlParameter
members, refer to the reference for
the System.Data.IDbDataParameter
and
System.Data.IDataParameter
interfaces, which
SqlParameter
implements.
In addition, the SqlParameter
class adds two
members. SqlDbType
sets the SQL Server data type
of a parameter. When you set SqlDbType
,
DbType
is updated automatically with the most
compatible value. The other member is the Offset
property, which is used for binary and string types. It returns the
offset in bytes for a binary parameter and in characters for a string
parameter.
public sealed class SqlParameter : MarshalByRefObject, System.Data.IDbDataParameter, System.Data.IDataParameter, ICloneable { // Public Constructors public SqlParameter( ); public SqlParameter(stringparameterName
, objectvalue
); public SqlParameter(stringparameterName
, System.Data.SqlDbTypedbType
); public SqlParameter(stringparameterName
, System.Data.SqlDbTypedbType
, intsize
); public SqlParameter(stringparameterName
, System.Data.SqlDbTypedbType
, intsize
, System.Data.ParameterDirectiondirection
, boolisNullable
, byteprecision
, bytescale
, stringsourceColumn
, System.Data.DataRowVersionsourceVersion
, objectvalue
); public SqlParameter(stringparameterName
, System.Data.SqlDbTypedbType
, intsize
, stringsourceColumn
); public DbType DbType{set; get; } // implements System.Data.IDataParameter public ParameterDirection Direction{set; get; } // implements System.Data.IDataParameter public bool IsNullable{set; get; } // implements System.Data.IDataParameter public int Offset{set; get; } public string ParameterName{set; get; } // implements System.Data.IDataParameter public byte Precision{set; get; } // implements System.Data.IDbDataParameter public byte Scale{set; get; } // implements System.Data.IDbDataParameter public int Size{set; get; } // implements System.Data.IDbDataParameter public string SourceColumn{set; get; } // implements System.Data.IDataParameter public DataRowVersion SourceVersion{set; get; } // implements System.Data.IDataParameter public SqlDbType SqlDbType{set; get; } public object Value{set; get; } // implements System.Data.IDataParameter // Public Instance Methods public override string ToString( ); // overrides object }