Cmdlets for TaxJar

Build 21.0.7930

SELECT INTO Statements

You can use the SELECT INTO statement to export formatted data to a file.

Data Export with an SQL Query

The following query exports data into a file formatted in comma-separated values (CSV):

C#

String connectionString = "APIKey=3bb04218ef8t80efdf1739abf7257144;";

using (TaxJarConnection connection = new TaxJarConnection(connectionString)) {
  TaxJarCommand cmd = new TaxJarCommand("SELECT TransactionID, UserID INTO [csv://Orders.txt] FROM [Orders] WHERE TransactionID = '123' ", connection);
  int rowsAffected = cmd.ExecuteNonQuery();
} 

VB.NET

Dim connectionString As [String] = "APIKey=3bb04218ef8t80efdf1739abf7257144;" 

Using connection As New TaxJarConnection(connectionString)
  Dim cmd As New TaxJarCommand("SELECT TransactionID, UserID INTO [csv://Orders.txt] FROM [Orders] WHERE TransactionID = '123'", connection)
  Dim rowsAffected As Integer = cmd.ExecuteNonQuery()
End Using
You can specify other file formats in the URI. The following example exports tab-separated values:

C#

String connectionString = "APIKey=3bb04218ef8t80efdf1739abf7257144;";

using (TaxJarConnection connection = new TaxJarConnection(connectionString)) {
  TaxJarCommand cmd = new TaxJarCommand("SELECT * INTO [Orders] IN [csv://filename=c:/Orders.csv;delimiter=tab] FROM [Orders] WHERE TransactionID = '123'", connection);
  int rowsAffected = cmd.ExecuteNonQuery();
} 

VB.NET

Dim connectionString As [String] = "APIKey=3bb04218ef8t80efdf1739abf7257144;" 

Using connection As New TaxJarConnection(connectionString)
  Dim cmd As New TaxJarCommand("SELECT * INTO [Orders] IN [csv://filename=c:/Orders.csv;delimiter=tab] FROM [Orders] WHERE TransactionID = '123'", connection)
  Dim rowsAffected As Integer = cmd.ExecuteNonQuery()
End Using

Copyright (c) 2021 CData Software, Inc. - All rights reserved.
Build 21.0.7930