Querying with the DataReader
The CData ADO.NET Provider for TaxJar implements two ADO.NET interfaces you can use to retrieve data from TaxJar: TaxJarDataAdapter and TaxJarDataReader objects. Whereas TaxJarDataAdapter objects retrieve a single result set of all the data that matches a query, TaxJarDataReader objects fetch data in subset increments as needed.
Using the TaxJarDataReader
The TaxJarDataReader retrieves data faster than the TaxJarDataAdapter because it can retrieve data in pages. As you read data from the TaxJarDataReader, 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 Orders table:
C#
string connectionString = "APIKey=3bb04218ef8t80efdf1739abf7257144;"; using (TaxJarConnection connection = new TaxJarConnection(connectionString)) { TaxJarCommand cmd = new TaxJarCommand("SELECT * FROM Orders", connection); TaxJarDataReader rdr = cmd.ExecuteReader(); while (rdr.Read()) { Console.WriteLine(String.Format("\t{0} --> \t\t{1}", rdr["TransactionID"], rdr["UserID"])); } }
VB.NET
Dim connectionString As String = "APIKey=3bb04218ef8t80efdf1739abf7257144;" Using connection As New TaxJarConnection(connectionString) Dim cmd As New TaxJarCommand("SELECT * FROM Orders", connection) Dim rdr As TaxJarDataReader = cmd.ExecuteReader() While rdr.Read() Console.WriteLine([String].Format(vbTab & "{0} --> " & vbTab & vbTab & "{1}", rdr("TransactionID"), rdr("UserID"))) End While End Using