NetSuite Data Provider - Online Help
NetSuite Data Provider
Questions / Feedback?

Querying Using the DataAdapter

The RSSBus ADO.NET Provider for NetSuite implements two ADO.NET interfaces you can use to retrieve data from NetSuite: NetSuiteDataAdapter and NetSuiteDataReader objects. Whereas NetSuiteDataAdapter objects retrieve a single result set of all the data that matches a query, NetSuiteDataReader objects fetch data in subset increments as needed.

Using The NetSuiteDataAdapter

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 will be populated with the queried data. Note that the NetSuiteDataAdapter is slower than the NetSuiteDataReader because the Fill method will need to retrieve all data from the data source before returning.

The example below selects the InternalId and AcctName columns of the Account table.

C#

string connectionString = "Account Id=XABC123456;Password=password;User=user;Role Id=3;Version=2013_1;Location=C:\\myfolder\\;Offline=false;";
using (NetSuiteConnection connection = new NetSuiteConnection(connectionString)) {
  NetSuiteDataAdapter dataAdapter = new NetSuiteDataAdapter(
  "SELECT InternalId, AcctName FROM Account", connection);

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

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

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

VB.NET

Dim connectionString As String = "Account Id=XABC123456;Password=password;User=user;Role Id=3;Version=2013_1;Location=C:\\myfolder\\;Offline=false;"
Using connection As New NetSuiteConnection(connectionString)
  Dim dataAdapter As New NetSuiteDataAdapter("SELECT InternalId, AcctName FROM Account", connection)

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

  Console.WriteLine("Contents of Account.")

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

 
 
Copyright (c) 2015 RSSBus, Inc. - All rights reserved.
Build 1.0.5578.0