asp.netvb.netentitydatasource

Asp:EntityDataSource: Make a insentitive diacritics search in where clause


I can't figure out how to do this.

I have a Gridview bind on a asp:EntityDataSource. This asp:EntityDataSource returns me a list of employe and the EntityDataSource can be filtered by a textbox on the name of the employee. I'm looking for a way to search by name being diacritics insentitive.

(Ex: Searching for "theroux" could return me "théroux" and/or "theroux". Or searching for "théroux" could return me "theroux" and/or "théroux")

I try searching in the canonical function but i didn't find anythings. Is there a way to do this without any code behind?

Here is my EntityDataSource

<asp:EntityDataSource ID="edsEmployes" runat="server" 
      ConnectionString="name=MyEntities" DefaultContainerName="MyEntities" 
      EntitySetName="Employes"
      where="it.Name like '%'+@keyword+'%' ">
          <WhereParameters>
             <asp:ControlParameter ControlID="txtKeyword" DbType="String" 
                        DefaultValue="%" Name="keyword" PropertyName="text" />
          </WhereParameters>
</asp:EntityDataSource>

Solution

  • Assuming you're using SQL Server for you database I would try changing the collation on that field in the database to SQL_Latin1_General_CP1_CI_AI. The AI at the end means accent insensitive which should filter as you are wanting it to.