Berker Yüceer
Berker Yüceer

Reputation: 7335

how to insert an array of id's into linq-to-sql query line in .net mvc 3

i want to get an array of id's which is like ["15", "26", "37", "48", "90"] and i want to get my remaining items from my remaining table that doesnt includes these supplier id's..

here what i done so far:

string[] arrgroupdetails;
arrgroupdetails = dataContext.GroupDetails.Select(c => c.supplier_id).ToArray();

var items = from thingies in dataContext.remainings where thingies.supplier_id.ToString() != arrgroupdetails.Any().ToString() select thingies;

so how can i achive this?

Upvotes: 0

Views: 550

Answers (1)

Pleun
Pleun

Reputation: 8920

By heart, so do check syntax but someething like this should work:

var items = from thingies in dataContext.remainings 
where !arrgroupdetails.Contains(thingies.supplier_id.ToString())
select thingies;

Upvotes: 1

Related Questions