Hello Everyone:
I've some WinForms dataGridViews with a complex dataSource. Specifically the DataSource is fed from a custom tableAdapter with a query from two tables.
When I update the database records, I can't get the DataGridViews to refresh the way I normally do it for a regular tableAdapter (with only one table).
- The TableAdapter feeds off both the Personnel_Tbl and the List_JobRanks Table.
- My load routine follows
// Load data into the 'aBC_ShiftDataSet.Personnel_Tbl' table. this.personnel_By_ListRankTableAdapter.Fill_By_ListRank(this.aBC_ShiftDataSet.Personnel_By_ListRank);
The queries are constructed into a custom table adapter named: personnel_By_ListRank
Typically this would refresh my DataGridView and show changes to the underlying database. But, it's not doing so. I figure it's because I'm using a TableAdapter that queries two tables.
So... I thought maybe I should fill the tableAdapters of both queried tables - as follows:
// Load data into the 'aBC_ShiftDataSet.Personnel_Tbl' table. this.personnel_TblTableAdapter.Fill(this.aBC_ShiftDataSet.Personnel_Tbl); this.list_JobRanksTableAdapter.Fill(this.aBC_ShiftDataSet.List_JobRanks); this.personnel_By_ListRankTableAdapter.Fill_By_ListRank(this.aBC_ShiftDataSet.Personnel_By_ListRank);
But that doesn't work either.
The underlying database records are being updated. If I preview the data in the DataSet Designer I can see the updates there. The problem seems to be refreshing my DataGridViews. More details about my DataGridView construction follow:
- The queries are constructed into a custom table adapter named: personnel_By_ListRank
- SQL for personnel_By_ListRank follows
SELECT Personnel_Tbl.PersonnelID, Personnel_Tbl.LName, Personnel_Tbl.FName, Personnel_Tbl.Rank, Personnel_Tbl.Shift, Personnel_Tbl.StationAssignment, Personnel_Tbl.HireDate, Personnel_Tbl.BirthDate, Personnel_Tbl.Address, Personnel_Tbl.City, Personnel_Tbl.State, Personnel_Tbl.ZipCode, Personnel_Tbl.FullName, Personnel_Tbl.Phone1, Personnel_Tbl.Phone1_Desc, Personnel_Tbl.Phone2, Personnel_Tbl.Phone2_Desc, List_JobRanks.RnkColor, List_JobRanks.RnkOrder FROM Personnel_Tbl INNER JOIN List_JobRanks ON Personnel_Tbl.Rank = List_JobRanks.Rank ORDER BY List_JobRanks.RnkOrder, Personnel_Tbl.FullName
DataGridView Construction example follows:
- Name of DataGridView: Unassigned_dataVW
- Binding Source for Unassigned_dataVW is unassignedBindingSource
- DataMember property for unassignedBindingSource is Personnel_By_ListRank
- DataSource property for unassignedBindingSource is aBC_ShiftDataSetT
Thanks in advance for advice on how to refresh the dataGridViews and showing updates to the database.
Pavilion