I have been searching in Google: linq to entities does not recognize the method int32 toint32
.
I have this list in my database like varchar
:
1 , 2 , 3 , 4 , 5 , 6 , 7 .
I need to order that list and get the max value. I'm using this but it doesn't work, I too saw other solutions here, but nothing works. This is my query:
var query= dbcontext.NV_Users.OrderBy(p => Convert.ToUInt32(p.code)).ToList().Max();
And I was trying with a normal query, also not working:
var query= from _NV_Field in dbcontext.NV_Users
orderby Convert.ToInt32(_NV_Field.code) ascending
select _NV_Field.code;
Before asking here , I've been searching Google like a crazy.