dotConnect for QuickBooks Online Documentation
Devart.Data.QuickBooks Namespace / QuickBooksCommand Class
Members Example

QuickBooksCommand Class
Represents a SQL statement or stored procedure to execute against QuickBooks Online.
Syntax
Remarks
The QuickBooksCommand class provides the following methods for executing commands against QuickBooks Online:
Item Description
ExecuteReader Executes commands that return rows.
Devart.Common.DbCommandBase.ExecutePageReader Returns a specific subset of rows when paging through the results of a query.
ExecuteNonQuery Executes SQL commands such as INSERT, DELETE, UPDATE.
ExecuteScalar Retrieves a single value (for example, an aggregate value) from a data source.

If execution of the command results in a fatal QuickBooksException, the QuickBooksConnection may close. However, the user can reopen the connection and continue.

Example
The following example uses the ExecuteReader method of QuickBooksCommand, along with QuickBooksDataReader and QuickBooksConnection, to select rows from a table.
public void ReadMyData(string myConnString)
{
  string mySelectQuery = "SELECT Id, DisplayName FROM Customer";
  QuickBooksConnection quickBooksConnection = new QuickBooksConnection(myConnString);
  QuickBooksCommand quickBooksCommand = new QuickBooksCommand(mySelectQuery,quickBooksConnection);
  quickBooksConnection.Open();
  QuickBooksDataReader quickBooksReader = quickBooksCommand.ExecuteReader();
  try
  {
    while (quickBooksReader.Read())
    {
      Console.WriteLine(quickBooksReader.GetString(0) + ", " + quickBooksReader.GetString(1));
    }
  }
  finally
  {
  // always call Close when done reading.
  quickBooksReader.Close();
  // always call Close when done reading.
  quickBooksConnection.Close();
  }
}
Public Sub ReadMyData(myConnString As String)
  Dim mySelectQuery As String = "SELECT Id, DisplayName FROM Customer"
  Dim quickBooksConnection As New QuickBooksConnection(myConnString)
  Dim quickBooksCommand As New QuickBooksCommand(mySelectQuery, quickBooksConnection)
  quickBooksConnection.Open()
  Dim quickBooksReader As QuickBooksDataReader = quickBooksCommand.ExecuteReader()
  Try
    While quickBooksReader.Read()
      Console.WriteLine(quickBooksReader.GetString(0) + ", " _
        + quickBooksReader.GetString(1))
    End While
  Finally
      ' always call Close when done reading.
      quickBooksReader.Close()
      ' always call Close when done with connection.
      quickBooksConnection.Close()
  End Try
End Sub
Inheritance Hierarchy

System.Object
   System.MarshalByRefObject
      System.ComponentModel.Component
         System.Data.Common.DbCommand
            Devart.Common.DbCommandBase
               Devart.Data.SqlShimCommand
                  Devart.Data.QuickBooks.QuickBooksCommand

Requirements

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also