The following example creates a
QuickBooksCommand, then executes it by passing a string that is SQL SELECT statement, and a string to use to connect to the data source.
public void CreateQuickBooksDataReader(string mySelectQuery,string quickBooksConnectionString)
{
QuickBooksConnection quickBooksConnection = new QuickBooksConnection(quickBooksConnectionString);
QuickBooksCommand quickBooksCommand = new QuickBooksCommand(mySelectQuery, quickBooksConnection);
quickBooksCommand.Connection.Open();
QuickBooksDataReader quickBooksReader = quickBooksCommand.ExecuteReader();
try
{
while(quickBooksReader.Read())
{
Console.WriteLine(quickBooksReader.GetString(0));
}
}
finally
{
quickBooksReader.Close();
quickBooksConnection.Close();
}
}
Public Sub CreateQuickBooksDataReader(mySelectQuery As String, _
quickBooksConnectionString As String)
Dim quickBooksConnection As New QuickBooksConnection(quickBooksConnectionString)
Dim quickBooksCommand As New QuickBooksCommand(mySelectQuery, quickBooksConnection)
quickBooksCommand.Connection.Open()
Dim quickBooksReader As QuickBooksDataReader = quickBooksCommand.ExecuteReader()
Try
While quickBooksReader.Read()
Console.WriteLine(quickBooksReader.GetString(0))
End While
Finally
quickBooksReader.Close()
quickBooksConnection.Close()
End Try
End Sub
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