OracleParameter.DbType 属性


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

 property System::Data::DbType DbType { System::Data::DbType get(); void set(System::Data::DbType value); };
 virtual property System::Data::DbType DbType { System::Data::DbType get(); void set(System::Data::DbType value); };
public System.Data.DbType DbType { get; set; }
public override System.Data.DbType DbType { get; set; }
member this.DbType : System.Data.DbType with get, set
Public Property DbType As DbType
Public Overrides Property DbType As DbType


DbType 值之一。One of the DbType values. 默认值为 AnsiStringThe default is AnsiString.




该属性未设置为有效的 DbTypeThe property was not set to a valid DbType.


下面的示例创建一个 OracleParameter 并设置其一些属性。The following example creates an OracleParameter and sets some of its properties.

public void CreateOracleDbParameter() 
    OracleParameter parameter = new OracleParameter();
    parameter.ParameterName = "pDName";
    parameter.DbType = DbType.String;
    parameter.Value = "ENGINEERING";
    parameter.SourceColumn = "DName";

Public Sub CreateOracleDbParameter()
    Dim parameter As New OracleParameter()
    parameter.ParameterName = "pDName"
    parameter.DbType = DbType.String
    parameter.Value = "ENGINEERING"
    parameter.SourceColumn = "DName"
End Sub 


OracleTypeDbType 已链接。The OracleType and DbType are linked. 因此,设置 DbType 会将 OracleType 更改为支持的 OracleTypeTherefore, setting the DbType changes the OracleType to a supporting OracleType.

可以通过设置 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. 例如,如果已推断出参数的大小,则在语句执行后 Size 不包含推断值。For example, if the size of the parameter has been inferred, Size does not contain inferred value after statement execution. 对于 String 数据类型,默认值为 AnsiStringFor String data types the default is AnsiString.

有关支持的数据类型的列表,请参阅相应的 OracleType 成员。For a list of the supported data types, see the appropriate OracleType member. 有关详细信息,请参阅DataAdapter 参数For more information, see DataAdapter Parameters.