日期:2014-05-20 浏览次数:20736 次
public static List<DataRow> FullTextSearch(this DataTable dataTable, string[] keywords)
{
var q = dataTable.AsEnumerable().Where<DataRow>(row => keywords.All(keyword => row.ItemArray.Select(p => p.ToString()).Any<string>(s => s.Contains(keyword))));
return q.ToList();
}
Public Shared Function FullTextSearch(dataTable As DataTable, keywords As String()) As List(Of DataRow)
Dim q = dataTable.AsEnumerable().Where(Of DataRow)(Function(row) keywords.All(Function(keyword) row.ItemArray.Select(Function(p) p.ToString()).Any(Of String)(Function(s) s.Contains(keyword))))
Return q.ToList()
End Function