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.ZohoDesk.ZohoDeskConnection, a
Devart.Data.ZohoDesk.ZohoDeskCommand, 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.ZohoDesk.ZohoDeskConnection.
|
|---|
public void ReadMyData(string myConnString)
{
string mySelectQuery = "SELECT AccountID, \"Account Name\" FROM Accounts";
ZohoDeskConnection ZohoDeskConnection = new ZohoDeskConnection(myConnString);
ZohoDeskCommand ZohoDeskCommand = new ZohoDeskCommand(mySelectQuery,ZohoDeskConnection);
ZohoDeskConnection.Open();
ZohoDeskDataReader ZohoDeskReader;
ZohoDeskReader = ZohoDeskCommand.ExecuteReader();
// Always call Read before accessing data.
while (ZohoDeskReader.Read()) {
Console.WriteLine(ZohoDeskReader.GetString(0) + ", " + ZohoDeskReader.GetString(1));
}
// always call Close when done reading.
ZohoDeskReader.Close();
// Close the connection when done with it.
ZohoDeskConnection.Close();
} |
|
|---|
Public Sub ReadMyData(myConnString As String)
Dim mySelectQuery As String = "SELECT AccountID, \"Account Name\" FROM Accounts"
Dim ZohoDeskConnection As New ZohoDeskConnection(myConnString)
Dim ZohoDeskCommand As New ZohoDeskCommand(mySelectQuery, ZohoDeskConnection)
ZohoDeskConnection.Open()
Dim ZohoDeskReader As ZohoDeskDataReader
ZohoDeskReader = ZohoDeskCommand.ExecuteReader()
' Always call Read before accessing data.
While ZohoDeskReader.Read()
Console.WriteLine(ZohoDeskReader.GetString(0) + ", " _
+ ZohoDeskReader.GetString(1))
End While
' always call Close when done reading.
ZohoDeskReader.Close()
' Close the connection when done with it.
ZohoDeskConnection.Close()
End Sub |