Share via


OdbcParameter.Direction 屬性

定義

取得或設定值,以表示參數是僅限輸入、僅限輸出、雙向 (Bidirectional) 或預存程序 (Stored Procedure) 傳回值參數。

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 會包含 Null 值。 Null 值是使用 DBNull 類別來處理。

Output呼叫 所ExecuteReader傳回的 、 InputOutReturnValue 參數必須等到您呼叫 CloseDispose 之後OdbcDataReader才能存取。

適用於

另請參閱