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