OracleParameter.Value 属性


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

 virtual property System::Object ^ Value { System::Object ^ get(); void set(System::Object ^ value); };
public override object Value { get; set; }
member this.Value : obj with get, set
Public Overrides Property Value As Object


一个对象,它是该参数的值。An object that is the value of the parameter. 默认值为 null。The default value is null.




对于输入参数,值将绑定到发送到服务器的 OracleCommandFor input parameters, the value is bound to the OracleCommand that is sent to the server. 对于输出和返回值参数,值将在 OracleCommand 完成时和 OracleDataReader 关闭后设置。For output and return-value parameters, the value is set on completion of the OracleCommand and after the OracleDataReader is closed.

对于输入参数,可以将 Value 设置为 Microsoft .NET 框架数据类型或 Oracle 数据类型(例如,OracleNumberOracleString)的对象。For an input parameter, Value can be set to an object of either a Microsoft .NET Framework data type or an Oracle data type (for example, an OracleNumber or OracleString).

将 null 参数值发送到服务器时,必须指定 DBNull,而不是 null。When you send a null parameter value to the server, you must specify DBNull, not null. 系统中的 null 值是没有值的空对象。A null value in the system is an empty object that has no value. DBNull 用于表示 null 值。DBNull is used to represent null values.

如果应用程序指定了数据库类型,则当提供程序将数据发送到服务器时,绑定值将转换为该类型。If the application specifies the database type, the bound value is converted to that type when the provider sends the data to the server. 如果提供程序支持 IConvertible 接口,则会尝试转换任何类型的值。The provider tries to convert any type of value if it supports the IConvertible interface. 如果指定的类型与值不兼容,则可能会导致转换错误。Conversion errors may result if the specified type is not compatible with the value.

参数的 DbTypeOracleTypeSize 属性可通过设置值进行推断。The DbType, OracleType, and Size properties of a parameter can be inferred by setting Value. 因此,您不需要指定它们。Therefore, you are not required to specify them. 但是,它们不 OracleParameter 属性设置公开。However, they are not exposed in OracleParameter property settings. 例如,如果已推断出参数的大小,则在语句执行后大小不包含推断值。For example, if the size of the parameter has been inferred, Size does not contain inferred value after statement execution.

除非输入值为 Oracle 数据类型(例如,Microsoft .NET 或 OracleNumber),否则 Value 属性使用的 InputOutputOutputReturnValueParameterDirection 值将为 Framework 数据类型。OracleStringThe InputOutput, Output, and ReturnValueParameterDirection values used by the Value property will be Microsoft .NET Framework data types, unless the input value was an Oracle data type (for example, OracleNumber or OracleString). 这并不适用于 REF CURSOR、BFILE 或 LOB 数据类型。This does not apply to REF CURSOR, BFILE, or LOB data types.

Update方法将覆盖 Value 属性。The Value property is overwritten by the Update method.