You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

BindingSource过滤AdvancedDataGridView无效问题求助

BindingSource过滤AdvancedDataGridView无效问题求助

大家好,我最近碰到个棘手的问题:我尝试用BindingSource过滤数据,然后把结果显示在AdvancedDataGridView里,但过滤功能完全没生效。这个BindingSource的数据是通过数据库查询填充的。

下面是我的代码:

private void SecteurForm_Load(object sender, EventArgs e)
{
    _bind.DataSource = _dbPreventif.T_PREVENTIF_COURANT.Where(e => e.PRE_COU_ID_SECTEUR == _idSecteur).ToList();
    advancedDataGridView1.DataSource = _bind;
    //dataGridView1.CellValueChanged += dataGridView1_CommentChanged;
}

private void button1_Click(object sender, EventArgs e)
{
    advancedDataGridView1.DataSource = null;
    advancedDataGridView1.Rows.Clear();
    _bind.Filter = "PRE_COU_ID = 2339";
    advancedDataGridView1.DataSource = _bind;
}

奇怪的是,如果我手动给BindingSource加行的话,过滤是正常工作的,但用数据库查出来的数据源就不行。有没有大佬能指点下问题出在哪?谢谢!

备注:内容来源于stack exchange,提问作者Eraaz

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.21 08:45:28