G
Guest
The following code retrieves data into a dataset, and then creates a dataview
with a filter. This dataview is then attached to a combobox. When the
effective date changes, I would like to see the newly filtered data without
having to create a new dataview each time. Is that possible?
Also, do I need to attach the dataview to the combo box each time?
if (AgencyCounties == null || sPropertyState.Text != prevPropertyState)
{
AgencyCounties = Producer.GetAgencyCounties(Producer.AgencyId,
sPropertyState.Text,"11");
AgencyCounties.Tables["Table"].TableName = "AgencyCounty";
prevPropertyState = sPropertyState.Text;
}
sPropertyCountyCd.BeginUpdate();
DataView viewCounties = new DataView(AgencyCounties.Tables["AgencyCounty"]);
string Filter = "StartDt <= '" + sEffectiveDt.Text + "' AND (StopDt is Null
OR StopDt > '" + sEffectiveDt.Text + "')";
viewCounties.RowFilter = Filter;
sPropertyCountyCd.DisplayMember = "Name";
sPropertyCountyCd.ValueMember = "CountyCd";
sPropertyCountyCd.DataSource = viewCounties;
sPropertyCountyCd.EndUpdate();
with a filter. This dataview is then attached to a combobox. When the
effective date changes, I would like to see the newly filtered data without
having to create a new dataview each time. Is that possible?
Also, do I need to attach the dataview to the combo box each time?
if (AgencyCounties == null || sPropertyState.Text != prevPropertyState)
{
AgencyCounties = Producer.GetAgencyCounties(Producer.AgencyId,
sPropertyState.Text,"11");
AgencyCounties.Tables["Table"].TableName = "AgencyCounty";
prevPropertyState = sPropertyState.Text;
}
sPropertyCountyCd.BeginUpdate();
DataView viewCounties = new DataView(AgencyCounties.Tables["AgencyCounty"]);
string Filter = "StartDt <= '" + sEffectiveDt.Text + "' AND (StopDt is Null
OR StopDt > '" + sEffectiveDt.Text + "')";
viewCounties.RowFilter = Filter;
sPropertyCountyCd.DisplayMember = "Name";
sPropertyCountyCd.ValueMember = "CountyCd";
sPropertyCountyCd.DataSource = viewCounties;
sPropertyCountyCd.EndUpdate();