Reputation: 311
I am recieving the following error Instance argument:
cannot convert from 'System.Collections.Generic.IEnumerable' to 'System.Linq.IQueryable'
Well the problem is the variable Assay.assayKey could be null in the table so I cannot have int assayKey instead of int? assayKey. I am stumped at this, could some one help?? thanks
Search Entry
{
int id {get;set;}
int? key {get;set;}
int[] selectedKeys {get;set;}
}
Assay
{
int id {get;set;}
int? AssayKey { get; set; }
}
CollObject
{
Ienumerable<int> keys {get;set;}
}
In my controller action method, am doing the following to retrieve an array of ids:
SearchEntry.selectedKeys = (from assays in db.assay
where CollObject.Keys.Contains(assay.AssayKey)
select assays.id).toArray();
Well I found the solution. Since Assay Key is a nullable int, I just had to do something like this
.Contains(assays.AssayKey ??0)
Upvotes: 2
Views: 2016
Reputation: 311
The problem was I could not use the .contains on a nullable int, so I had to do something like this to make it work
.Contains(assays.AssayKey ??0)
Upvotes: 3