Querying with the DataAdapter
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 OracleEloquaReportingDataAdapter
Use the adapter's Fill method to retrieve data from the data source. An empty DataTable instance is passed as an argument to the Fill method. When the method returns, the DataTable instance is populated with the queried data. Note that the OracleEloquaReportingDataAdapter is slower than the OracleEloquaReportingDataReader because the Fill method needs to retrieve all data from the data source before returning.
The following example selects the accountId and accountName columns of the AccountActivity.Account table:
C#
string connectionString = "User=user;Password=password;Company=MyCompany";
using (OracleEloquaReportingConnection connection = new OracleEloquaReportingConnection(connectionString)) {
OracleEloquaReportingDataAdapter dataAdapter = new OracleEloquaReportingDataAdapter(
"SELECT accountId, accountName FROM AccountActivity.Account", connection);
DataTable table = new DataTable();
dataAdapter.Fill(table);
Console.WriteLine("Contents of AccountActivity.Account.");
foreach (DataRow row in table.Rows) {
Console.WriteLine("{0}: {1}", row["accountId"], row["accountName"]);
}
}
VB.NET
Dim connectionString As String = "User=user;Password=password;Company=MyCompany"
Using connection As New OracleEloquaReportingConnection(connectionString)
Dim dataAdapter As New OracleEloquaReportingDataAdapter("SELECT accountId, accountName FROM AccountActivity.Account", connection)
Dim table As New DataTable()
dataAdapter.Fill(table)
Console.WriteLine("Contents of AccountActivity.Account.")
For Each row As DataRow In table.Rows
Console.WriteLine("{0}: {1}", row("accountId"), row("accountName"))
Next
End Using