OdbcParameter.Direction 属性

定义

获取或设置一个值,该值指示参数是只可输入的参数、只可输出的参数、双向参数还是存储过程返回值参数。Gets or sets a value that indicates whether the parameter is input-only, output-only, bidirectional, or a stored procedure return value parameter.

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

属性值

ParameterDirection 值之一。One of the ParameterDirection values. 默认为 InputThe default is Input.

实现

异常

属性未设置为有效的 ParameterDirection 值之一。The property was not set to one of the valid ParameterDirection values.

示例

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

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 值。If the ParameterDirection is Output, and execution of the associated OdbcCommand does not return a value, the OdbcParameter will contain a null value. 使用 DBNull 类处理 Null 值。Null values are handled using the DBNull class.

Close 上调用 DisposeOdbcDataReader之前,无法访问通过调用 ExecuteReader 返回的 OutputInputOutReturnValue 参数。Output, InputOut, and ReturnValue parameters returned by calling ExecuteReader cannot be accessed until you call Close or Dispose on the OdbcDataReader.

适用于

另请参阅