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该值将包含 null 值。 使用类处理 DBNull Null 值。
Output
InputOut在ReturnValue调用或ExecuteReader打开CloseDispose之前,无法访问通过调用OdbcDataReader返回的参数。