public DataSet SelectDynamicsSrvRows(DataSet myDataSet,string dynamicsConnection,string mySelectQuery,string myTableName)
{
DynamicsConnection myConn = new DynamicsConnection(dynamicsConnection);
DynamicsDataAdapter myDataAdapter = new DynamicsDataAdapter();
myDataAdapter.SelectCommand = new DynamicsCommand(mySelectQuery, myConn);
DynamicsCommandBuilder dynamicsCommandBuilder = new DynamicsCommandBuilder(myDataAdapter);
myConn.Open();
DataSet myDataSet = new DataSet();
myDataAdapter.Fill(myDataSet, "Departments");
//code to modify data in dataset here
//Without the DynamicsCommandBuilder this line would fail
myDataAdapter.Update(myDataSet, "Departments");
myConn.Close();
return myDataSet;
}