public DataSet SelectPgSqlSrvRows(DataSet myDataSet,string pgConnection,string mySelectQuery,string myTableName)
{
PgSqlConnection myConn = new PgSqlConnection(pgConnection);
PgSqlDataAdapter myDataAdapter = new PgSqlDataAdapter();
myDataAdapter.SelectCommand = new PgSqlCommand(mySelectQuery, myConn);
PgSqlCommandBuilder pgCommandBuilder = new PgSqlCommandBuilder(myDataAdapter);
myConn.Open();
DataSet myDataSet = new DataSet();
myDataAdapter.Fill(myDataSet, "Departments");
//code to modify data in dataset here
//Without the PgSqlCommandBuilder this line would fail
myDataAdapter.Update(myDataSet, "Departments");
myConn.Close();
return myDataSet;
}