V
Val
Hi,
My progy for a book shop shows stock, it has a tabcontrol with 3 tabs, on
each page thers a DataGrid (dg).
For each DataGrid thers a oleDbDataAdapter (da) and a DataSet (ds).
All 3 datasets pull data from the same table through their
DataAdapters - each with a different query; so da1 fills ds1 wiv all the
records (select * from books),
da2 fills ds2 wiv low stock (select * from books where stock<wotever) and
da3 fills ds3 wiv no stock (select * from books where stock = 0).
When user edits the records another form (dialog) pops up, upon completion
user clicks "Save Data" and the changes are put into ds1.
It then calls "da1.Update(ds1)" to save all the changes.
The problem:
When changes are saved from ds1 to the database I then try and update the
other DataSets by refilling them and redrawing the DataGrids like so:
////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////
private void updateStuff()
{
oleDbDataAdapter1.Fill(ds1,"Books");
oleDbDataAdapter2.Fill(ds2,"Books");
oleDbDataAdapter3.Fill(ds3,"Books");
dataGrid1.Update();
dataGrid2.Update();
dataGrid3.Update();
}
////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////
BUT! Only DataGrid1 (dg1) updates correctly, the other 2 usually stay the
same, but sometimes do work.
I was braking my head for ages now and still cant figure out why. I tried
Refresh instead of Update to redraw DataGrids, but that didn't do anything
different.
Thanks everyone!
My progy for a book shop shows stock, it has a tabcontrol with 3 tabs, on
each page thers a DataGrid (dg).
For each DataGrid thers a oleDbDataAdapter (da) and a DataSet (ds).
All 3 datasets pull data from the same table through their
DataAdapters - each with a different query; so da1 fills ds1 wiv all the
records (select * from books),
da2 fills ds2 wiv low stock (select * from books where stock<wotever) and
da3 fills ds3 wiv no stock (select * from books where stock = 0).
When user edits the records another form (dialog) pops up, upon completion
user clicks "Save Data" and the changes are put into ds1.
It then calls "da1.Update(ds1)" to save all the changes.
The problem:
When changes are saved from ds1 to the database I then try and update the
other DataSets by refilling them and redrawing the DataGrids like so:
////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////
private void updateStuff()
{
oleDbDataAdapter1.Fill(ds1,"Books");
oleDbDataAdapter2.Fill(ds2,"Books");
oleDbDataAdapter3.Fill(ds3,"Books");
dataGrid1.Update();
dataGrid2.Update();
dataGrid3.Update();
}
////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////
BUT! Only DataGrid1 (dg1) updates correctly, the other 2 usually stay the
same, but sometimes do work.
I was braking my head for ages now and still cant figure out why. I tried
Refresh instead of Update to redraw DataGrids, but that didn't do anything
different.
Thanks everyone!