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

QuickBooksDataReader Class
Reads a forward-only stream of rows from QuickBooks Online.
Syntax
Remarks
To create a QuickBooksDataReader, you must call the ExecuteReader method of the QuickBooksCommand object, rather than directly using a constructor.

System.Data.Common.DbDataReader.IsClosed and Devart.Data.SqlShimDataReader.RecordsAffected are the only properties that you can call after the QuickBooksDataReader is closed. In some cases, you must call Devart.Data.SqlShimDataReader.Close before you can call Devart.Data.SqlShimDataReader.RecordsAffected.

Example
The following example creates a QuickBooksConnection, a QuickBooksCommand, and a QuickBooksDataReader. The example reads through the data, writing it out to the console. Finally, the example closes the QuickBooksDataReader, then the QuickBooksConnection.
public void ReadMyData(string myConnString)  {
        QuickBooksConnection quickBooksConnection = new QuickBooksConnection(myConnString);
        QuickBooksCommand quickBooksCommand = (QuickBooksCommand)quickBooksConnection.CreateCommand();
        quickBooksCommand.CommandText = "SELECT Id, DisplayName, Notes FROM Customer";
        quickBooksConnection.Open();
        QuickBooksDataReader quickBooksReader = quickBooksCommand.ExecuteReader();
        try {
                // Always call Read before accessing data.
                while (quickBooksReader.Read()) {
                Console.WriteLine(quickBooksReader.GetString(0) + " " + 
                quickBooksReader.GetString(1) + " " + quickBooksReader.GetString(2));
        }
        }
        finally {
                // always call Close when done reading.
                quickBooksReader.Close();

                // Close the connection when done with it.
                quickBooksConnection.Close();
        }
}
Public Sub ReadMyData(ByVal myConnString As String)
        Dim quickBooksConnection As New QuickBooksConnection(myConnString)
        Dim quickBooksCommand As QuickBooksCommand = quickBooksConnection.CreateCommand()
                quickBooksCommand.CommandText = "SELECT Id, DisplayName, Notes FROM Customer"
        quickBooksConnection.Open()
        Dim quickBooksReader As QuickBooksDataReader = quickBooksCommand.ExecuteReader()
        Try
                ' Always call Read before accessing data.
                While quickBooksReader.Read()
                        Console.WriteLine(String.Concat(quickBooksReader.GetString(0), " ", _
                        quickBooksReader.GetString(1), " ", quickBooksReader.GetString(2)))
                End While
        Finally
                ' always call Close when done reading.
                quickBooksReader.Close()

                        ' Close the connection when done with it.
                        quickBooksConnection.Close()
        End Try
End Sub
Inheritance Hierarchy

System.Object
   System.MarshalByRefObject
      System.Data.Common.DbDataReader
         Devart.Common.DbDataReaderBase
            Devart.Data.SqlShimDataReader
               Devart.Data.QuickBooks.QuickBooksDataReader

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