public DataSet SelectSugarSrvRows(DataSet myDataSet,string sugarConnection,string mySelectQuery,string myTableName)
{
SugarConnection myConn = new SugarConnection(sugarConnection);
SugarDataAdapter myDataAdapter = new SugarDataAdapter();
myDataAdapter.SelectCommand = new SugarCommand(mySelectQuery, myConn);
SugarCommandBuilder sugarCommandBuilder = new SugarCommandBuilder(myDataAdapter);
myConn.Open();
DataSet myDataSet = new DataSet();
myDataAdapter.Fill(myDataSet, "Departments");
//code to modify data in dataset here
//Without the SugarCommandBuilder this line would fail
myDataAdapter.Update(myDataSet, "Departments");
myConn.Close();
return myDataSet;
}