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 |