Querying with the DataReader
The CData ADO.NET Provider for Oracle Eloqua Reporting implements two ADO.NET interfaces you can use to retrieve data from Oracle Eloqua Reporting: OracleEloquaReportingDataAdapter and OracleEloquaReportingDataReader objects. Whereas OracleEloquaReportingDataAdapter objects retrieve a single result set of all the data that matches a query, OracleEloquaReportingDataReader objects fetch data in subset increments as needed.
Using the OracleEloquaReportingDataReader
The OracleEloquaReportingDataReader retrieves data faster than the OracleEloquaReportingDataAdapter because it can retrieve data in pages. As you read data from the OracleEloquaReportingDataReader, it periodically requests the next page of results from the data source, if required. This causes results to be returned at a faster rate. The following example selects all the columns from the AccountActivity.Account table:
C#
string connectionString = "User=user;Password=password;Company=MyCompany";
using (OracleEloquaReportingConnection connection = new OracleEloquaReportingConnection(connectionString)) {
OracleEloquaReportingCommand cmd = new OracleEloquaReportingCommand("SELECT * FROM AccountActivity.Account", connection);
OracleEloquaReportingDataReader rdr = cmd.ExecuteReader();
while (rdr.Read()) {
Console.WriteLine(String.Format("\t{0} --> \t\t{1}", rdr["accountId"], rdr["accountName"]));
}
}
VB.NET
Dim connectionString As String = "User=user;Password=password;Company=MyCompany"
Using connection As New OracleEloquaReportingConnection(connectionString)
Dim cmd As New OracleEloquaReportingCommand("SELECT * FROM AccountActivity.Account", connection)
Dim rdr As OracleEloquaReportingDataReader = cmd.ExecuteReader()
While rdr.Read()
Console.WriteLine([String].Format(vbTab & "{0} --> " & vbTab & vbTab & "{1}", rdr("accountId"), rdr("accountName")))
End While
End Using