D
Dennis__V
Guest
Ive been struggling with a problem for days.
I always try to let Visual Studio take care of the binding by dragging and dropping tables on to a form. Then Fill() does the rest.
this.tblTriCntrsTableAdapter.Fill(this.processDataSet.tblTriCntrs);
I added a line in Fill in the commandText DataSet.xsd file by adding WHERE (InActive = false)
The binding source is automatically created.
In this case I needed two binding sources where the DataMember = tblTriCntrs and the DataSource = processDataSet.
So I renamed the original and created a second just like the original. Except they have different names and filters.
tblTriCntrs1BindingSource.Filter = "TricanterNum = 1";
tblTriCntrs2BindingSource.Filter = "TricanterNum = 2";
There is never more than one record with "Inactive = false" for each binding source. And sometimes just one or neither have a record where "Inactive = false"
This all works well everywhere in a fairly substantial program.
Except where I need to let the user scroll through closed / "Inactive = true" records.
So I create a temporary table "tblREVIEW1" to load just one record at a time where "Inactive = true" and this works well for viewing the closed records.
I change the Data Source like this: tblTriCntrs1BindingSource.DataSource = tblREVIEW1;
When the user is done scrolling I reset the Data Source back the way it was like this: tblTriCntrs1BindingSource.DataSource = this.processDataSet.tblTriCntrs;
This is where Im having problems.
For some reason the above filters are no longer working after changing the data source back to the way it was.
DataRowView drv1 = (DataRowView)tblTriCntrs1BindingSource.List[0];
DataRowView drv2 = (DataRowView)tblTriCntrs2BindingSource.List[0];
Both drv1 and drv2 point to the same record even though drv1s filter should make it not point to any records because there is no "TricanterNum = 1" WHERE (InActive = false) They all = true
I tried Load() again and resetting the filters after the load but nothing works.
Sorry for all this. I just hope this make sense and someone can help me get the binding sources back on track.
Thank you.
Continue reading...
I always try to let Visual Studio take care of the binding by dragging and dropping tables on to a form. Then Fill() does the rest.
this.tblTriCntrsTableAdapter.Fill(this.processDataSet.tblTriCntrs);
I added a line in Fill in the commandText DataSet.xsd file by adding WHERE (InActive = false)
The binding source is automatically created.
In this case I needed two binding sources where the DataMember = tblTriCntrs and the DataSource = processDataSet.
So I renamed the original and created a second just like the original. Except they have different names and filters.
tblTriCntrs1BindingSource.Filter = "TricanterNum = 1";
tblTriCntrs2BindingSource.Filter = "TricanterNum = 2";
There is never more than one record with "Inactive = false" for each binding source. And sometimes just one or neither have a record where "Inactive = false"
This all works well everywhere in a fairly substantial program.
Except where I need to let the user scroll through closed / "Inactive = true" records.
So I create a temporary table "tblREVIEW1" to load just one record at a time where "Inactive = true" and this works well for viewing the closed records.
I change the Data Source like this: tblTriCntrs1BindingSource.DataSource = tblREVIEW1;
When the user is done scrolling I reset the Data Source back the way it was like this: tblTriCntrs1BindingSource.DataSource = this.processDataSet.tblTriCntrs;
This is where Im having problems.
For some reason the above filters are no longer working after changing the data source back to the way it was.
DataRowView drv1 = (DataRowView)tblTriCntrs1BindingSource.List[0];
DataRowView drv2 = (DataRowView)tblTriCntrs2BindingSource.List[0];
Both drv1 and drv2 point to the same record even though drv1s filter should make it not point to any records because there is no "TricanterNum = 1" WHERE (InActive = false) They all = true
I tried Load() again and resetting the filters after the load but nothing works.
Sorry for all this. I just hope this make sense and someone can help me get the binding sources back on track.
Thank you.
Continue reading...