Using SQL CONVERT function through nHibernate Criterion

前端 未结 2 1256
我在风中等你
我在风中等你 2020-12-11 23:55

I have a sql view, in which the data type of every column is string, for use with the jquery datatables plugin.

One of the columns contains a uk format

2条回答
  •  一整个雨季
    2020-12-12 00:32

    If the setting 104 is not essential, we can get a quick solution: use CAST instead of CONVERT. This SQL Function is built-in in the NHibernate dialects:

    Projections.Cast(NHibernateUtil.DateTime
                   ,Projections.Property(propNames[orderByColumn]))
    

    If the setting 104 is important we can create our own Dialect, register the CONVERT function, and use it from then ... forever

    Here Andrew Whitaker nicely shows how to

    • Nhibernate count distinct (based on multiple columns)

提交回复
热议问题