Linq to SQL error : An order by expression can only contain non-constant scalars

后端 未结 2 404
南笙
南笙 2020-12-18 14:46

I\'m using a GridView and a LinqDataSource to view the Categories table. I set the Gridview to enable sorting. Sorting generally works except when i clicked on the header of

2条回答
  •  情深已故
    2020-12-18 15:28

    SQL Server just doesn't let you order by NText fields (see also error 420 in the SQL Server Error List). My guess is that it's for efficiency reasons, but I couldn't say for sure.

    Now the solution in the linked article is cast to nvarchar... but that's obviously pretty hard to do in LINQ.

    Does your description field definitely need to be an ntext?

提交回复
热议问题