OdbcParameter.Direction 属性

定义

获取或设置一个值,该值指示参数是只可输入的参数、只可输出的参数、双向参数还是存储过程返回值参数。

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

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;  
}  

注解

如果关联ParameterDirectionOutput项的执行OdbcCommand不返回值,则OdbcParameter该值将包含 null 值。 使用类处理 DBNull Null 值。

Output``InputOut``ReturnValue在调用CloseDispose打开OdbcDataReader之前,无法访问通过调用ExecuteReader返回的参数和参数。

适用于

另请参阅