IDataParameter.Direction IDataParameter.Direction IDataParameter.Direction IDataParameter.Direction Property

定义

获取或设置一个值,该值指示参数是只可输入的参数、只可输出的参数、双向参数还是存储过程返回值参数。Gets or sets a value indicating 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.

示例

下面的示例创建一个实现类SqlParameter的实例, 并设置其一些属性。The following example creates an instance of the implementing class, SqlParameter, and sets some of its properties.

public void CreateSqlParameter() 
{
    SqlParameter parameter = new SqlParameter(
        "@Description", SqlDbType.VarChar);
    parameter.Direction = ParameterDirection.Output;
}
Public Sub CreateSqlParameter()
    Dim parameter As New SqlParameter( _
        "@Description", SqlDbType.VarChar)
    parameter.Direction = ParameterDirection.Output
End Sub 

注解

如果是输出, 且关联SqlCommand的执行不返回值, 则IDataParameter包含 null 值。 ParameterDirectionIf the ParameterDirection is output, and execution of the associated SqlCommand does not return a value, the IDataParameter contains a null value.

在读取Output InputOut最后一个结果集中的最后一行后, 将更新、 ReturnValue 、和参数。After the last row from the last resultset is read, Output, InputOut, and ReturnValue parameters are updated.

适用于