dotConnect for Oracle Documentation
Devart.Data.Oracle Namespace / OracleCommand Class / ExecuteReader Method / ExecuteReader() Method
Example

ExecuteReader() Method
Sends the CommandText to the Connection and builds a OracleDataReader.
Syntax
'Declaration
 
Public Overloads Shadows Function ExecuteReader() As OracleDataReader
 

Return Value

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.
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();
  try
  {
    while(myReader.Read())
    {
      Console.WriteLine(myReader.GetString(0));
    }
  }
  finally
  {
    myReader.Close();
    myConnection.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()
  Try
    While myReader.Read()
      Console.WriteLine(myReader.GetString(0))
    End While
  Finally
    myReader.Close()
    myConnection.Close()
  End Try
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