日期:2014-05-18  浏览次数:21128 次

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)");