Reputation: 1708
Using MVC. In my form I have a textbox where user will enter item codes in this manner 100,101,102.
The basically I need to query the table.
if (!String.IsNullOrEmpty(searchItemcode))
{
var itemList = searchItemcode.Split(',').Select(p => p.Trim());
priceHistory = priceHistory.Where(s => itemList.Contains(s.ITEM_CODE));
}
but in the DB, my field is double and this is not working. I was thinking may be to create a list ? then use that in my linq?
Upvotes: 0
Views: 379
Reputation: 11763
have you tried:
if (!String.IsNullOrEmpty(searchItemcode))
{
var itemList = searchItemcode.Split(',').Select(p => double.Parse(p.Trim()));
priceHistory = priceHistory.Where(s => itemList.Contains(s.ITEM_CODE));
}
It should give you doubles.
Upvotes: 2