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
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2