Read Method (SqlShimDataReader)
|
|---|
'Declaration
Public Overrides Function Read() As Boolean |
|
|---|
public override bool Read() |
Return Value
true if there are more rows; otherwise, false.
The following example creates a
Devart.Data.Zoho.ZohoConnection, a
Devart.Data.Zoho.ZohoCommand, 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.Zoho.ZohoConnection.
|
|---|
public void ReadMyData(string myConnString)
{
string mySelectQuery = "SELECT AccountID, \"Account Name\" FROM Accounts";
ZohoConnection zohoConnection = new ZohoConnection(myConnString);
ZohoCommand zohoCommand = new ZohoCommand(mySelectQuery,zohoConnection);
zohoConnection.Open();
ZohoDataReader zohoReader;
zohoReader = zohoCommand.ExecuteReader();
// Always call Read before accessing data.
while (zohoReader.Read()) {
Console.WriteLine(zohoReader.GetString(0) + ", " + zohoReader.GetString(1));
}
// always call Close when done reading.
zohoReader.Close();
// Close the connection when done with it.
zohoConnection.Close();
} |
|
|---|
Public Sub ReadMyData(myConnString As String)
Dim mySelectQuery As String = "SELECT AccountID, \"Account Name\" FROM Accounts"
Dim zohoConnection As New ZohoConnection(myConnString)
Dim zohoCommand As New ZohoCommand(mySelectQuery, zohoConnection)
zohoConnection.Open()
Dim zohoReader As ZohoDataReader
zohoReader = zohoCommand.ExecuteReader()
' Always call Read before accessing data.
While zohoReader.Read()
Console.WriteLine(zohoReader.GetString(0) + ", " _
+ zohoReader.GetString(1))
End While
' always call Close when done reading.
zohoReader.Close()
' Close the connection when done with it.
zohoConnection.Close()
End Sub |