I have a string field in database that keeps numbers as string. when I want to order based on this field in Linq as below but orderby does not work well. it orders like this
1 – 2 – 3 – 25 – 11 – 30 – 50 ===> 1 – 11 – 2 – 25 – 3 – 30 – 50
IQueryable<Tbl_Melk> Melks =
from melk in Tbl_Melk
where melk.Mantaghe == Mantaghe && melk.Hoze == Hoze && melk.Block == Block
orderby melk.Melk
select melk;
What says Maurice is right, You may try this:
But with that you are losing performance and the IQuerable interface.