一、問題
已知 數據表 dtAll,dtAll中包含字段 【columnsA】、【columnsB】,要篩選出 columnsA 爲“A”,columnsB 爲 “B”的數據
二、方法
'1.創建容器接收篩選結果
dim dt as datatable
'2.把datatable 轉換爲dataview格式
dim dv as dataview =new dataview(dtAll)
'3.條件篩選
dv.RowFilter=string.format("{0}='{1}' and {2}='{3}'",columnsA ,"A",columnsB,"B")
'4.接收結果
dt=dv.ToTable