mvc3 rank zipcodes in uniform order

I have a database that contains over 10,000 U.S. zipcodes whats the best way to put these zipcodes in order? right now they are all shuffles around like : 10201,45089,32809 and I would like them to be in order from smallest to biggest like 10201,32809,45089 etc. They are under the field of "zip"

 var getinfo = sqlConnection.Query<zipcodes>("Select * from zipcodes ORDER BY zip DESC").ToList();
            foreach (var item in getinfo)

                db.Entry(item).State = EntityState.Modified;


Thats the code I have above and it is not ranking properly is there something else im missing? property zip is a float.


Descending would put them from largest to smallest. What you want is to sort by ascending. This can be done with linq:

 var sortedZipCodeList = getinfo.OrderBy(x => x.Id);

Id would be whatever property is in the zipcodes class that your trying to sort by. (for descending order the syntax is: .OrderByDescending(x => x.Id))

Need Your Help

Tooltip set in by method in c# code

c# telerik

trying to get same string on tooltip as is in the "Text" e.g.

HTML Hyperlink to a specific scene in a swf file

html actionscript-3 hyperlink flash

I have an swf file with many scenes. I would like to be able to add multiple hyperlinks to a company Intranet site (set up on SharePoint) that link to specific scenes in the swf file. Is this possi...