Represents an open connection to Zoho CRM.
The following example creates a
ZohoCommand and a
ZohoConnection. The
ZohoConnection is opened and set as the
Connection property. The example then calls
ExecuteNonQuery method, and closes the connection. To accomplish this, the
ExecuteNonQuery is passed a connection string and a query string that is SQL INSERT statement.
public void InsertRow(string zohoConnectionString)
{
// If the connection string is empty, use default.
if(zohoConnectionString == "")
{
zohoConnectionString =
"API Version=V2;Refresh Token=1000.a6fde76542bfbb5244a7e539d4390e72.87e34ea57023c2d0e7dcb9ce55e3e7f3;ClientId=1000.M4FJLKYTSED90LJHUTVMKKAA432RUK;ClientSecret=89a0ed79957808814cdb20b9765423efffa767d1d0";
}
ZohoConnection myConn = new ZohoConnection(zohoConnectionString);
string myInsertQuery = "INSERT INTO Accounts (\"Account Name\", Phone) VALUES ('Test','555-555-555')";
ZohoCommand zohoCommand = new ZohoCommand(myInsertQuery);
zohoCommand.Connection = myConn;
myConn.Open();
try
{
zohoCommand.ExecuteNonQuery();
}
finally
{
myConn.Close();
}
}
Public Sub InsertRow(zohoConnectionString As String)
' If the connection string is empty, use default.
If zohoConnectionString = "" Then
zohoConnectionString = _
"API Version=V2;Refresh Token=1000.a6fde76542bfbb5244a7e539d4390e72.87e34ea57023c2d0e7dcb9ce55e3e7f3;ClientId=1000.M4FJLKYTSED90LJHUTVMKKAA432RUK;ClientSecret=89a0ed79957808814cdb20b9765423efffa767d1d0"
End If
Dim myConn As New ZohoConnection(zohoConnectionString)
Dim myInsertQuery As String = "INSERT INTO Accounts (\"Account Name\", Phone) VALUES ('Test','555-555-555')"
Dim zohoCommand As New ZohoCommand(myInsertQuery)
zohoCommand.Connection = myConn
myConn.Open()
Try
zohoCommand.ExecuteNonQuery()
Finally
myConn.Close()
End Try
End Sub