Parameter.DbType Parameter.DbType Parameter.DbType Parameter.DbType Property

定義

取得或設定參數的資料庫型別。Gets or sets the database type of the parameter.

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

屬性值

Parameter 執行個體的資料庫型別。The database type of the Parameter instance. 預設值為 ObjectThe default value is Object.

例外狀況

已嘗試將此屬性設定為不屬於 DbType 列舉中的值。An attempt was made to set this property to a value that is not in the DbType enumeration.

備註

資料庫類型可用來建立強型別參數,以便在您的 Web 應用程式與基礎程式碼之間,或從資料庫資料表中的值轉換成正確的值。The database type can be used to create strongly typed parameters, so that values are converted correctly between your Web application and underlying code or values from database tables.

如果藉由設定DbType屬性來變更參數的資料庫類型,則OnParameterChanged會呼叫方法。If the database type of the parameter is changed by setting the DbType property, the OnParameterChanged method is called.

適用於