我在查詢DataSet.Tables [0]並刪除不符合critira的列的行時遇到了一些問題。過濾一個DataTable,其中的表不包含List中的項目<string>
//This is my list
var values = new List<string> {"Test", "Test2"};
// Now I just query the DataSet for anything that doesnt match this list
var query = from x in ds.Tables[0].AsEnumerable()
from b in values
where !x.Field<string>("ColumnName").Contains(b)
select x;
這工作並返回結果,但它返回2 x集相同的行(我假設因爲沒有連接)。
我怎樣才能得到這些行的不同值?
三江源,那正是我在後。 – 2011-12-20 12:53:24