Automatically generates single-table commands used to reconcile changes made to a
System.Data.DataSet with the Zoho CRM.
The following example uses
ZohoCommand, along with
ZohoDataAdapter and
ZohoConnection, to select rows from Zoho CRM. 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 CRM table. The example then creates a
ZohoCommandBuilder.
|
|---|
public DataSet SelectZohoSrvRows(DataSet myDataSet,string zohoConnection,string mySelectQuery,string myTableName)
{
ZohoConnection myConn = new ZohoConnection(zohoConnection);
ZohoDataAdapter myDataAdapter = new ZohoDataAdapter();
myDataAdapter.SelectCommand = new ZohoCommand(mySelectQuery, myConn);
ZohoCommandBuilder zohoCommandBuilder = new ZohoCommandBuilder(myDataAdapter);
myConn.Open();
DataSet myDataSet = new DataSet();
myDataAdapter.Fill(myDataSet, "Departments");
//code to modify data in dataset here
//Without the ZohoCommandBuilder this line would fail
myDataAdapter.Update(myDataSet, "Departments");
myConn.Close();
return myDataSet;
} |
|
|---|
Public Function SelectZohoSrvRows(myDataSet As DataSet, zohoConnection As String, mySelectQuery As String, myTableName As String) As DataSet
Dim myConn As New ZohoConnection(zohoConnection)
Dim myDataAdapter As New ZohoDataAdapter()
myDataAdapter.SelectCommand = New ZohoCommand(mySelectQuery, myConn)
Dim zohoCommandBuilder As ZohoCommandBuilder = New ZohoCommandBuilder(myDataAdapter)
myConn.Open()
Dim myDataSet As DataSet = New DataSet
myDataAdapter.Fill(myDataSet, "Departments")
' Code to modify data in DataSet here
' Without the ZohoCommandBuilder this line would fail.
myDataAdapter.Update(myDataSet, "Departments")
myConn.Close()
SelectZohoSrvRows = myDataSet
End Function |