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;
}
注解
如果关联ParameterDirectionOutput
项的执行OdbcCommand不返回值,则OdbcParameter该值将包含 null 值。 使用类处理 DBNull Null 值。
Output``InputOut``ReturnValue
在调用Close或Dispose
打开OdbcDataReader之前,无法访问通过调用ExecuteReader返回的参数和参数。