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 |