I am trying to sort a list of products by their name in a .Net application written in C#, to obtain the same list that I would get from an SQL Server database through an order by: select * from Products order by ProductName
Unfortunately, the application sorting behaves differently than the database sorting. It is probably related to the collation: the database has an SQL_Latin1_General_CP1_CI_AS collation.
How can I make the application sort these strings exactly like the database does?
Thanks.
UPDATE: I finally obtained a good result by using the code from the comments below, and changing the compare options to Ordinal:
private CompareOptions myOptions = CompareOptions.Ordinal ;
Also, this link contains some very useful information related to SQL collations: http://blogs.msdn.com/michkap/archive/2005/11/08/490305.aspx