读书人

DataTable中的select语句应该如何写

发布时间: 2012-09-04 14:19:30 作者: rapoo

DataTable中的select语句应该怎么写?
DataTable table中的两列columnA和columnB,想在columnA和columnB中搜索两个值的组合,{v1,v2},{v3,v4},一个组合的语句是select("columnA = v1 and columnB = v3"),select("columnA = v1 and columnB = v4"),select("columnA = v2 and columnB = v3"),select("columnA = v2 and columnB = v4"),现在想用一句select完成上述4句的功能,该怎么写?

[解决办法]
用 or 把4个条件连起来呗
[解决办法]

C# code
datatable.select(" (columnA = v1 and columnB = v3) or (columnA = v1 and columnB = v4) or (columnA = v2 and columnB = v3) or (columnA = v2 and columnB = v4)"); 

读书人网 >C#

热点推荐