ZohoDeskCommandBuilder Class
Automatically generates single-table commands used to reconcile changes made to a
System.Data.DataSet with the Zoho Desk.
The following example uses
ZohoDeskCommand, along with
ZohoDeskDataAdapter and
ZohoDeskConnection, to select rows from Zoho Desk. The example is passed an initialized
System.Data.DataSet, a connection string, a query string that is SQL SELECT statement, and a string that is the name of the Zoho Desk table. The example then creates a
ZohoDeskCommandBuilder.
public DataSet SelectZohoDeskSrvRows(DataSet myDataSet,string ZohoDeskConnection,string mySelectQuery,string myTableName)
{
ZohoDeskConnection myConn = new ZohoDeskConnection(ZohoDeskConnection);
ZohoDeskDataAdapter myDataAdapter = new ZohoDeskDataAdapter();
myDataAdapter.SelectCommand = new ZohoDeskCommand(mySelectQuery, myConn);
ZohoDeskCommandBuilder ZohoDeskCommandBuilder = new ZohoDeskCommandBuilder(myDataAdapter);
myConn.Open();
DataSet myDataSet = new DataSet();
myDataAdapter.Fill(myDataSet, "Departments");
//code to modify data in dataset here
//Without the ZohoDeskCommandBuilder this line would fail
myDataAdapter.Update(myDataSet, "Departments");
myConn.Close();
return myDataSet;
}
Public Function SelectZohoDeskSrvRows(myDataSet As DataSet, ZohoDeskConnection As String, mySelectQuery As String, myTableName As String) As DataSet
Dim myConn As New ZohoDeskConnection(ZohoDeskConnection)
Dim myDataAdapter As New ZohoDeskDataAdapter()
myDataAdapter.SelectCommand = New ZohoDeskCommand(mySelectQuery, myConn)
Dim ZohoDeskCommandBuilder As ZohoDeskCommandBuilder = New ZohoDeskCommandBuilder(myDataAdapter)
myConn.Open()
Dim myDataSet As DataSet = New DataSet
myDataAdapter.Fill(myDataSet, "Departments")
' Code to modify data in DataSet here
' Without the ZohoDeskCommandBuilder this line would fail.
myDataAdapter.Update(myDataSet, "Departments")
myConn.Close()
SelectZohoDeskSrvRows = myDataSet
End Function
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