Direction Property

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.

[Visual Basic]
Property Direction As ParameterDirection
ParameterDirection Direction {get; set;}
__property ParameterDirection get_Direction();
__property void set_Direction(ParameterDirection);
function get Direction() : ParameterDirection;function set Direction(ParameterDirection);

Property Value

One of the ParameterDirection values. The default is Input.


Exception Type Condition
ArgumentException The property was not set to one of the valid ParameterDirection values.


If the ParameterDirection is output, and execution of the associated SqlCommand does not return a value, the IDataParameter contains a null value.

After the last row from the last resultset is read, Output, InputOut, and ReturnValue parameters are updated.


[Visual Basic, C#, C++] The following example creates an instance of the implementing class, SqlParameter, and sets some of its properties.

[Visual Basic] 
Public Sub CreateSqlParameter()
    Dim myParameter As New SqlParameter("@Description", SqlDbType.VarChar)
    myParameter.Direction = ParameterDirection.Output
End Sub 'CreateSqlParameter

public void CreateSqlParameter() 
    SqlParameter myParameter = new SqlParameter("@Description", SqlDbType.VarChar);
    myParameter.Direction = ParameterDirection.Output;

void CreateSqlParameter() 
    SqlParameter* myParameter = new SqlParameter(S"@Description", SqlDbType::VarChar);
    myParameter->Direction = ParameterDirection::Output;

[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button Language Filter in the upper-left corner of the page.


Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, .NET Compact Framework

See Also

IDataParameter Interface | IDataParameter Members | System.Data Namespace

© 2015 Microsoft