且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何跨具有空格字符的字段名称过滤datagridview?

更新时间:2023-02-18 23:06:35

我终于找到了.过滤类似于使用 sql 查询.如果有空格字符只需要在列名中添加'['和']'字符即可.就我而言,这非常有效:

At last i found it. The filtering is similar to work with sql queries. If there is space characters only need to add '[' and ']' characters to column name. In my case, this works perfectly:

(datagridview.DataSource as DataTable).DefaultView.RowFilter =
                string.Format("[MÜŞTERİ ADI] LIKE '%{0}%'", textbox.Text.ToUpper());