Represents a SQL statement or stored procedure to execute against Zoho Books.
The following example uses the
ExecuteReader method of
ZohoBooksCommand, along with
ZohoBooksDataReader and
ZohoBooksConnection, to select rows from a table.
|
|---|
public void ReadMyData(string myConnString)
{
string mySelectQuery = "SELECT AccountID, \"Account Name\" FROM Accounts";
ZohoBooksConnection zohoBooksConnection = new ZohoBooksConnection(myConnString);
ZohoBooksCommand zohoBooksCommand = new ZohoBooksCommand(mySelectQuery,zohoBooksConnection);
zohoBooksConnection.Open();
ZohoBooksDataReader zohoBooksReader = zohoBooksCommand.ExecuteReader();
try
{
while (zohoBooksReader.Read())
{
Console.WriteLine(zohoBooksReader.GetString(0) + ", " + zohoBooksReader.GetString(1));
}
}
finally
{
// always call Close when done reading.
zohoBooksReader.Close();
// always call Close when done reading.
zohoBooksConnection.Close();
}
} |
|
|---|
Public Sub ReadMyData(myConnString As String)
Dim mySelectQuery As String = "SELECT AccountID, \"Account Name\" FROM Accounts"
Dim zohoBooksConnection As New ZohoBooksConnection(myConnString)
Dim zohoBooksCommand As New ZohoBooksCommand(mySelectQuery, zohoBooksConnection)
zohoBooksConnection.Open()
Dim zohoBooksReader As ZohoBooksDataReader = zohoBooksCommand.ExecuteReader()
Try
While zohoBooksReader.Read()
Console.WriteLine(zohoBooksReader.GetString(0) + ", " _
+ zohoBooksReader.GetString(1))
End While
Finally
' always call Close when done reading.
zohoBooksReader.Close()
' always call Close when done with connection.
zohoBooksConnection.Close()
End Try
End Sub |