Name

SqlParameter

Synopsis

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(string parameterName, object value);  

   public SqlParameter(string parameterName,  System.Data.SqlDbType dbType);

   public SqlParameter(string parameterName, System.Data.SqlDbType dbType, int size);

   public SqlParameter(string parameterName, System.Data.SqlDbType dbType, int size, 

        System.Data.ParameterDirection direction, bool isNullable, byte precision, 

        byte scale, string sourceColumn, System.Data.DataRowVersion sourceVersion, object value);

   public SqlParameter(string parameterName, System.Data.SqlDbType dbType, int size, string sourceColumn);

   public DbType DbType{set; get; }                            // implements System.Data.IDataParameter public ParameterDirection ...

Get ADO.NET in a Nutshell now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.