Represents a SQL statement or stored procedure to execute against Zoho CRM.
The following example uses the
ExecuteReader method of
ZohoCommand, along with
ZohoDataReader and
ZohoConnection, to select rows from a table.
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 = zohoCommand.ExecuteReader();
try
{
while (zohoReader.Read())
{
Console.WriteLine(zohoReader.GetString(0) + ", " + zohoReader.GetString(1));
}
}
finally
{
// always call Close when done reading.
zohoReader.Close();
// always call Close when done reading.
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 = zohoCommand.ExecuteReader()
Try
While zohoReader.Read()
Console.WriteLine(zohoReader.GetString(0) + ", " _
+ zohoReader.GetString(1))
End While
Finally
' always call Close when done reading.
zohoReader.Close()
' always call Close when done with connection.
zohoConnection.Close()
End Try
End Sub