ADO.NET Provider for SAP Business Warehouse

Build 26.0.9655

Querying with the DataReader

The CData ADO.NET Provider for SAP Business Warehouse implements two ADO.NET interfaces you can use to retrieve data from SAP Business Warehouse: SAPBUSINESSWAREHOUSEDataAdapter and SAPBUSINESSWAREHOUSEDataReader objects. Whereas SAPBUSINESSWAREHOUSEDataAdapter objects retrieve a single result set of all the data that matches a query, SAPBUSINESSWAREHOUSEDataReader objects fetch data in subset increments as needed.

Using the SAPBUSINESSWAREHOUSEDataReader

The SAPBUSINESSWAREHOUSEDataReader retrieves data faster than the SAPBUSINESSWAREHOUSEDataAdapter because it can retrieve data in pages. As you read data from the SAPBUSINESSWAREHOUSEDataReader, 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 [2CREPM_DEPSOV3].[2CREPM_DEPSOV3/2CREPM_DEPSOQV3].Customer table:

C#

string connectionString = "User=myuseraccount;Password=mypassword;URL=http://localhost:8000/sap/bw/xml/soap/xmla;";

using (SAPBUSINESSWAREHOUSEConnection connection = new SAPBUSINESSWAREHOUSEConnection(connectionString)) {
  SAPBUSINESSWAREHOUSECommand cmd = new SAPBUSINESSWAREHOUSECommand("SELECT Country, Education FROM [2CREPM_DEPSOV3].[2CREPM_DEPSOV3/2CREPM_DEPSOQV3].Customer", connection);
  
  SAPBUSINESSWAREHOUSEDataReader rdr = cmd.ExecuteReader();

  while (rdr.Read()) {
    Console.WriteLine(String.Format("\t{0} --> \t\t{1}", rdr["Country"], rdr["Education"]));
  }
}

VB.NET

Dim connectionString As String = "User=myuseraccount;Password=mypassword;URL=http://localhost:8000/sap/bw/xml/soap/xmla;"

Using connection As New SAPBUSINESSWAREHOUSEConnection(connectionString)
  Dim cmd As New SAPBUSINESSWAREHOUSECommand("SELECT Country, Education FROM [2CREPM_DEPSOV3].[2CREPM_DEPSOV3/2CREPM_DEPSOQV3].Customer", connection)

  Dim rdr As SAPBUSINESSWAREHOUSEDataReader = cmd.ExecuteReader()

  While rdr.Read()
    Console.WriteLine([String].Format(vbTab & "{0} --> " & vbTab & vbTab & "{1}", rdr("Country"), rdr("Education")))
  End While
End Using

Copyright (c) 2026 CData Software, Inc. - All rights reserved.
Build 26.0.9655