I have two DataTables:
dt1 - personid, name
dt2 - personid
I want to create a third datatable to include records from dt1 when they are NOT in dt2 using LINQ. In this case, I can bind the third datatable to a dropdownlist.
any help would be great开发者_C百科! thanks!
Although it's in C#, But It could be translated to VB with a little effort
dt1.AsEnumerable()
.Where(o => dt2.Select("personId =" + o["personId"].ToString()).Length == 0);
VB:
dt1.AsEnumerable()
.Where(Function(o)
dt2.Select("personId =" & o("personId").ToString()).Length = 0)
精彩评论