我正在尝试使用日期列对数据进行排序,但该列排序为字符串而不是日期。如何解决这个问题呢?
代码:
var projection = Projections.SqlFunction("lower", NHibernateUtil.String,Projections.Property("datecolumn1"));
if(order="desc")queryOver = queryOver.OrderBy(projection).Desc;
else queryOver = queryOver.OrderBy(projection).Asc;
结果:(按升序排序)
8/7/2012 5:34 AM
11/7/2012 7:21 AM
11/7/2012 7:21 AM
11/7/2012 7:21 AM
11/7/2012 7:21 AM
8/27/2012 9:35 AM