Read Method (SqlShimDataReader)
public override bool Read()
'Declaration
Public Overrides Function Read() As Boolean
Return Value
true if there are more rows; otherwise, false.
The following example creates a
Devart.Data.QuickBooks.QuickBooksConnection, a
Devart.Data.QuickBooks.QuickBooksCommand, and a
SqlShimDataReader. The example reads through the data, writing it out to the console. Finally, the example closes the
SqlShimDataReader, then the
Devart.Data.QuickBooks.QuickBooksConnection.
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;
quickBooksReader = quickBooksCommand.ExecuteReader();
// Always call Read before accessing data.
while (quickBooksReader.Read()) {
Console.WriteLine(quickBooksReader.GetString(0) + ", " + quickBooksReader.GetString(1));
}
// always call Close when done reading.
quickBooksReader.Close();
// Close the connection when done with it.
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
quickBooksReader = quickBooksCommand.ExecuteReader()
' Always call Read before accessing data.
While quickBooksReader.Read()
Console.WriteLine(quickBooksReader.GetString(0) + ", " _
+ quickBooksReader.GetString(1))
End While
' always call Close when done reading.
quickBooksReader.Close()
' Close the connection when done with it.
quickBooksConnection.Close()
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