dotConnect for Oracle Documentation
Devart.Data.Oracle Namespace / OracleCommand Class / ExecuteReader Method / ExecuteReader(CommandBehavior) Method
One of the System.Data.CommandBehavior values.
Example

In This Topic
    ExecuteReader(CommandBehavior) Method
    In This Topic
    Sends the CommandText to the Connection, and builds a OracleDataReader using one of the System.Data.CommandBehavior values.
    Syntax
    'Declaration
     
    Public Overloads Shadows Function ExecuteReader( _
       ByVal behavior As CommandBehavior _
    ) As OracleDataReader
    public new OracleDataReader ExecuteReader( 
       CommandBehavior behavior
    )

    Parameters

    behavior
    One of the System.Data.CommandBehavior values.

    Return Value

    Remarks

    The OracleDataReader supports a special mode that enables large binary values to be read efficiently. For more information, see the SequentialAccess setting for System.Data.CommandBehavior.

    Example
    The following example creates a OracleCommand, then executes it by passing a string that is SQL SELECT statement, and a string to use to connect to the data source. The System.Data.CommandBehavior is then set to CloseConnection.
    public void CreateOracleDataReader(string mySelectQuery,string myConnectionString)
    {
      OracleConnection myConnection = new OracleConnection(myConnectionString);
      OracleCommand myCommand = new OracleCommand(mySelectQuery, myConnection);
      myCommand.Connection.Open();
      OracleDataReader myReader = myCommand.ExecuteReader(CommandBehavior.CloseConnection);
      while(myReader.Read())
      {
        Console.WriteLine(myReader.GetString(0));
      }
      myReader.Close();
    }
    Public Sub CreateOracleDataReader(mySelectQuery As String, _
    myConnectionString As String)
      Dim myConnection As New OracleConnection(myConnectionString)
      Dim myCommand As New OracleCommand(mySelectQuery, myConnection)
      myCommand.Connection.Open()
      Dim myReader As OracleDataReader = myCommand.ExecuteReader(CommandBehavior.CloseConnection)
      While myReader.Read()
        Console.WriteLine(myReader.GetString(0))
      End While
      myReader.Close()
    End Sub
    Requirements

    Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

    See Also