OdbcParameter.Direction 屬性
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
取得或設定一個值,指示參數是僅輸入、僅輸出、雙向,或是儲存程序回傳值參數。
public:
virtual property System::Data::ParameterDirection Direction { System::Data::ParameterDirection get(); void set(System::Data::ParameterDirection value); };
public:
property System::Data::ParameterDirection Direction { System::Data::ParameterDirection get(); void set(System::Data::ParameterDirection value); };
public override System.Data.ParameterDirection Direction { get; set; }
public System.Data.ParameterDirection Direction { get; set; }
member this.Direction : System.Data.ParameterDirection with get, set
Public Overrides Property Direction As ParameterDirection
Public Property Direction As ParameterDirection
屬性值
這是其中一項 ParameterDirection 價值。 預設值為 Input。
實作
例外狀況
該屬性並未設定為有效 ParameterDirection 值之一。
範例
以下範例建立 並 OdbcParameter 設定其部分性質。
Public Sub CreateMyProc(connection As OdbcConnection)
Dim command As OdbcCommand = connection.CreateCommand()
command.CommandText = "{ call MyProc(?,?,?) }"
command.Parameters.Add("", OdbcType.Int).Value = 1
command.Parameters.Add("", OdbcType.Decimal).Value = 2
command.Parameters.Add("", OdbcType.Decimal).Value = 3
End Sub
public void CreateMyProc(OdbcConnection connection)
{
OdbcCommand command = connection.CreateCommand();
command.CommandText = "{ call MyProc(?,?,?) }";
command.Parameters.Add("", OdbcType.Int).Value = 1;
command.Parameters.Add("", OdbcType.Decimal).Value = 2;
command.Parameters.Add("", OdbcType.Decimal).Value = 3;
}
備註
若 ParameterDirection 為 Output,且執行關聯 OdbcCommand 後未回傳值,則 將 OdbcParameter 包含空值。 空值則使用類別 DBNull 來處理。
Output
InputOut, , 且ReturnValue呼叫回傳的參數ExecuteReader必須在你呼叫Close或Dispose在 OdbcDataReader上才能存取。