ADO.NET Provider for Sage X3 Cloud

Build 26.0.9770

Querying with the DataAdapter

The CData ADO.NET Provider for Sage X3 Cloud implements two ADO.NET interfaces you can use to retrieve data from Sage X3 Cloud: SageX3CloudDataAdapter and SageX3CloudDataReader objects. Whereas SageX3CloudDataAdapter objects retrieve a single result set of all the data that matches a query, SageX3CloudDataReader objects fetch data in subset increments as needed.

Using the SageX3CloudDataAdapter

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 SageX3CloudDataAdapter is slower than the SageX3CloudDataReader because the Fill method needs to retrieve all data from the data source before returning.

The following example selects the Name and Description columns of the Customer table:

C#

string connectionString = "URL=https://x3server/;OAuthAccessTokenUrl=https://auth-domain/oauth/token;OAuthClientId=your_client_id;OAuthClientSecret=your_client_secret;Audience=https://api-audience;XAPIKey=your_api_key;Folder=SEED;";

using (SageX3CloudConnection connection = new SageX3CloudConnection(connectionString)) {
  SageX3CloudDataAdapter dataAdapter = new SageX3CloudDataAdapter(
  "SELECT Name, Description FROM Customer", connection);

  DataTable table = new DataTable();
  dataAdapter.Fill(table);

  Console.WriteLine("Contents of Customer.");

  foreach (DataRow row in table.Rows) {
    Console.WriteLine("{0}: {1}", row["Name"], row["Description"]);
  }
}

VB.NET

Dim connectionString As String = "URL=https://x3server/;OAuthAccessTokenUrl=https://auth-domain/oauth/token;OAuthClientId=your_client_id;OAuthClientSecret=your_client_secret;Audience=https://api-audience;XAPIKey=your_api_key;Folder=SEED;"

Using connection As New SageX3CloudConnection(connectionString)
  Dim dataAdapter As New SageX3CloudDataAdapter("SELECT Name, Description FROM Customer", connection)

  Dim table As New DataTable()
  dataAdapter.Fill(table)

  Console.WriteLine("Contents of Customer.")

  For Each row As DataRow In table.Rows
    Console.WriteLine("{0}: {1}", row("Name"), row("Description"))
  Next
End Using

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