Export (0) Print
Expand All

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
[C#]
ParameterDirection Direction {get; set;}
[C++]
__property ParameterDirection get_Direction();
__property void set_Direction(ParameterDirection);
[JScript]
function get Direction() : ParameterDirection;function set Direction(ParameterDirection);

Property Value

One of the ParameterDirection values. The default is Input.

Exceptions

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

Remarks

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.

Example

[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

[C#] 
public void CreateSqlParameter() 
 {
    SqlParameter myParameter = new SqlParameter("@Description", SqlDbType.VarChar);
    myParameter.Direction = ParameterDirection.Output;
 }

[C++] 
public:
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.

Requirements

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

Show:
© 2014 Microsoft