0
當試圖使用VB.net中的LINQ執行查詢以選擇以前填充數據集的某個數據表的某些員工時,使用where子句時出現問題。我想要的是選擇數據表的所有員工,除了名爲CurrentExcludedEmployeesLst的排除的員工列表中出現的員工之外。所以我按照這些步驟:LINQ Where子句問題
1.-首先我填寫我的數據表'僱員'的數據集。我的數據集有一個包含三個列的表,EMPLID,NAME,DEPT。
Dim employees As DataTable
employees = Me.MyDataset.Tables("EMPLOYEESTABLE")
2:我構建查詢:
Dim employeeCollection As EnumerableRowCollection
employeeCollection =
employees.AsEnumerable() _
.Select(Function(employee As DataRow) New With _
{ _
.EMPLID = employee.Field(Of String)("EMPLID"), _
.NAME = employee.Field(Of String)("NAME"), _
.TITLE = employee.Field(Of String)("DEPT") _
}).Where(Function(employee As DataRow) NOT
CurrentExcludedEmployeesLst.Contains(employee.Field(Of String)("EMPLID")))
如果我不把它完美的WHERE子句。我的問題是當我想使用Where子句進行過濾時。
謝謝!