Linq nie jest zaznaczony na datatable
Witam mam 2 tabele danych (lista zabronionych, lista krajów), obie zawierają listę nazw krajów i kodeków w kolumnach cc i kraju. Próbuję wykonać zapytanie, w którym mogę wybrać kraje z tabeli countrylist, które nie znajdują się w tabeli zakazanej listy, aby utworzyć trzecią tabelę.
Jakieś pomysły?
Nie zaszedłem za daleko.
var ccList = ds.Tables[2].AsEnumerable();
var bannedCCList = ds.Tables[1].AsEnumerable();
var query = from r in ccList....
..
po próbie
var bannedCCList = ds.Tables[1].AsEnumerable();
var query = from r in ccList where !bannedCCList.Any(b => b["cc"] == r["cc"])select r;
Nadal dostaję tę samą listę krajów. zabronione nie zostały usunięte. tutaj jest więcej szczegółów, aby wyjaśnić więcej. nie wiem, co robię źle
protected void BindCountryBan(string subd)
{
DataSet ds = new DataSet();
ds = new DB().CountryBan_GetSiteSettings();
BannedCountryListBox.DataSource = ds.Tables[1];
BannedCountryListBox.DataValueField = "cc";
BannedCountryListBox.DataTextField = "country";
BannedCountryListBox.DataBind();
//bind country list
var ccList = ds.Tables[2].AsEnumerable();
var bannedCCList = ds.Tables[1].AsEnumerable();
var query = from r in ccList where !bannedCCList.Any(b => b["cc"] == r["cc"])select r;
//var query = ccList.Except(bannedCCList);
//CountryListBox.DataSource = ds.Tables[2];
DataTable boundTable = query.CopyToDataTable<DataRow>();
CountryListBox.DataSource = boundTable;
CountryListBox.DataValueField = "cc";
CountryListBox.DataTextField = "country";
CountryListBox.DataBind();
}