我正在使用文本框来搜索datagridview.但它只搜索一列.我也想用它来搜索其他列.我目前用于搜索栏的代码是:
private void autoZoeken_txt_TextChanged(object sender, EventArgs e) { DataView DV = new DataView(dbdataset); DV.RowFilter = string.Format("kenteken LIKE '%{0}%'", autoZoeken_txt.Text); autoView_dgv.DataSource = DV; }
Mike Perreno.. 5
您只需修改代码即可利用OR
:
private void autoZoeken_txt_TextChanged(object sender, EventArgs e) { DataView DV = new DataView(dbdataset); DV.RowFilter = string.Format( "kenteken LIKE '%{0}%' OR field2 LIKE '%{0}%'", autoZoeken_txt.Text); autoView_dgv.DataSource = DV; }
等等.
您只需修改代码即可利用OR
:
private void autoZoeken_txt_TextChanged(object sender, EventArgs e) { DataView DV = new DataView(dbdataset); DV.RowFilter = string.Format( "kenteken LIKE '%{0}%' OR field2 LIKE '%{0}%'", autoZoeken_txt.Text); autoView_dgv.DataSource = DV; }
等等.