I'm using C# Version 6
, I having a string variable and I'm trying to sort the LINQ to SQL database table, earlier its working fine but now its not giving appropriate sorting result.
using (var db = new DBEntity()) {
var propertyInfo = nameof(Client.ClientName);
var iQuery = db.Clients.OrderByDescending(i => propertyInfo);
foreach (var item in iQuery.ToList()) {
Console.WriteLine(item.ClientName);
}
}
Note: I refereed lots of tutorial in Stack overflow blog and other sites but I can't able to find.
Kindly assist me, whats wrong in my code.
Table Structure and Data
ClientName ClientStatus
______________________________
Emma Active
Harry Active
In both Ascending and Descending I'm getting the same output
ClientName ClientStatus
______________________________
Emma Active
Harry Active