Represents an open connection to Zoho Desk.
The following example creates a
ZohoDeskCommand and a
ZohoDeskConnection. The
ZohoDeskConnection 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 ZohoDeskConnectionString)
{
// If the connection string is empty, use default.
if(ZohoDeskConnectionString == "")
{
ZohoDeskConnectionString =
Refresh Token=1000.a6fde76542bfbb5244a7e539d4390e72.87e34ea57023c2d0e7dcb9ce55e3e7f;
}
ZohoDeskConnection myConn = new ZohoDeskConnection(ZohoDeskConnectionString);
string myInsertQuery = "INSERT INTO Accounts (\"Account Name\", Phone) VALUES ('Test','555-555-555')";
ZohoDeskCommand ZohoDeskCommand = new ZohoDeskCommand(myInsertQuery);
ZohoDeskCommand.Connection = myConn;
myConn.Open();
try
{
ZohoDeskCommand.ExecuteNonQuery();
}
finally
{
myConn.Close();
}
} |
|
|---|
Public Sub InsertRow(ZohoDeskConnectionString As String)
' If the connection string is empty, use default.
If ZohoDeskConnectionString = "" Then
ZohoDeskConnectionString = _
Refresh Token=1000.a6fde76542bfbb5244a7e539d4390e72.87e34ea57023c2d0e7dcb9ce55e3e7f
End If
Dim myConn As New ZohoDeskConnection(ZohoDeskConnectionString)
Dim myInsertQuery As String = "INSERT INTO Accounts (\"Account Name\", Phone) VALUES ('Test','555-555-555')"
Dim ZohoDeskCommand As New ZohoDeskCommand(myInsertQuery)
ZohoDeskCommand.Connection = myConn
myConn.Open()
Try
ZohoDeskCommand.ExecuteNonQuery()
Finally
myConn.Close()
End Try
End Sub |