How to compare a string column(as DateTime) in LINQ?

Posted by lyon on Stack Overflow See other posts from Stack Overflow or by lyon
Published on 2012-07-02T02:58:26Z Indexed on 2012/07/02 3:16 UTC
Read the original article Hit count: 236

Filed under:
|

I have a database with a ValidDate field - it's a string(we made a mistake, it should be a datetime, but we can't modify the database now.)

and now I want to compare this filed with a parameter(validDateStart) from the website:

priceList = priceList.Where(p => Convert.ToDateTime(p.ValidDate) >= Convert.ToDateTime(validDateStart));
var list = initPriceList.ToList();

But I get an error: The method ToDateTime is not implemented.

Can anybody give me some help? Thanks!

© Stack Overflow or respective owner

Related posts about c#

Related posts about LINQ