Ignoring accents in SQL Server using LINQ to SQL

前端 未结 4 1872
梦谈多话
梦谈多话 2020-12-17 19:20

How can I ignore accents (like ´, `, ~) in queries made to a SQL Server database using LINQ to SQL?

UPDATE:

Still haven\'t figured out how t

4条回答
  •  遥遥无期
    2020-12-17 20:00

    In SQL queries (Sql Server 2000+, as I recall), you do this by doing something like select MyString, MyId from MyTable where MyString collate Latin1_General_CI_AI ='aaaa'.

    I'm not sure if this is possible in Linq, but someone more cozy with Linq can probably translate.

    If you are ok with sorting and select/where queries ALWAYS ignoring accents, you can alter the table to specify the same collation on the field(s) with which you are concerned.

提交回复
热议问题