DbParameter 类

定义

表示 DbCommand 的参数,还可以是它到 DataSet 列的映射。Represents a parameter to a DbCommand and optionally, its mapping to a DataSet column. 有关参数的详细信息,请参阅配置参数和参数数据类型For more information on parameters, see Configuring Parameters and Parameter Data Types.

public ref class DbParameter abstract : MarshalByRefObject, System::Data::IDbDataParameter
public abstract class DbParameter : MarshalByRefObject, System.Data.IDbDataParameter
type DbParameter = class
    inherit MarshalByRefObject
    interface IDbDataParameter
    interface IDataParameter
Public MustInherit Class DbParameter
Inherits MarshalByRefObject
Implements IDbDataParameter
继承
派生
实现

构造函数

DbParameter()

初始化 DbParameter 类的新实例。Initializes a new instance of the DbParameter class.

属性

DbType

获取或设置参数的 DbTypeGets or sets the DbType of the parameter.

Direction

获取或设置一个值,该值指示参数是仅限输入、仅限输出、双向还是存储过程返回值参数。Gets or sets a value that indicates whether the parameter is input-only, output-only, bidirectional, or a stored procedure return value parameter.

IsNullable

获取或设置一个值,该值指示参数是否接受 null 值。Gets or sets a value that indicates whether the parameter accepts null values.

ParameterName

获取或设置 DbParameter 的名称。Gets or sets the name of the DbParameter.

Precision

获取或设置用于表示 Value 属性的最大位数。Gets or sets the maximum number of digits used to represent the Value property.

Scale

获取或设置所解析的 Value 的小数位数。Gets or sets the number of decimal places to which Value is resolved.

Size

获取或设置列中数据的最大大小(字节)。Gets or sets the maximum size, in bytes, of the data within the column.

SourceColumn

获取或设置源列的名称,该源列映射到 DataSet 并用于加载或返回 ValueGets or sets the name of the source column mapped to the DataSet and used for loading or returning the Value.

SourceColumnNullMapping

获取或设置一个值,该值指示源列是否可以为 null。Gets or sets a value which indicates whether the source column is nullable. 通过此操作,DbCommandBuilder 能够为可以为 null 的列正确地生成 Update 语句。This allows DbCommandBuilder to correctly generate Update statements for nullable columns.

SourceVersion

获取或设置在加载 DataRowVersion 时使用的 ValueGets or sets the DataRowVersion to use when you load Value.

Value

获取或设置参数的值。Gets or sets the value of the parameter.

方法

CreateObjRef(Type)

创建一个对象,该对象包含生成用于与远程对象进行通信的代理所需的全部相关信息。Creates an object that contains all the relevant information required to generate a proxy used to communicate with a remote object.

(继承自 MarshalByRefObject)
Equals(Object)

确定指定的对象是否等于当前对象。Determines whether the specified object is equal to the current object.

(继承自 Object)
GetHashCode()

用作默认哈希函数。Serves as the default hash function.

(继承自 Object)
GetLifetimeService()

检索控制此实例的生存期策略的当前生存期服务对象。Retrieves the current lifetime service object that controls the lifetime policy for this instance.

(继承自 MarshalByRefObject)
GetType()

获取当前实例的 TypeGets the Type of the current instance.

(继承自 Object)
InitializeLifetimeService()

获取生存期服务对象来控制此实例的生存期策略。Obtains a lifetime service object to control the lifetime policy for this instance.

(继承自 MarshalByRefObject)
MemberwiseClone()

创建当前 Object 的浅表副本。Creates a shallow copy of the current Object.

(继承自 Object)
MemberwiseClone(Boolean)

创建当前 MarshalByRefObject 对象的浅表副本。Creates a shallow copy of the current MarshalByRefObject object.

(继承自 MarshalByRefObject)
ResetDbType()

将 DbType 属性重置为其原始设置。Resets the DbType property to its original settings.

ToString()

返回一个表示当前对象的 string。Returns a string that represents the current object.

(继承自 Object)

显式接口实现

IDataParameter.SourceVersion
IDbDataParameter.Precision

指示数值参数的精度。Indicates the precision of numeric parameters.

IDbDataParameter.Scale

有关此成员的说明,请参阅 ScaleFor a description of this member, see Scale.

适用于

另请参阅