Milad
Milad

Reputation: 1

SQL Arabic Search

I have a search program in ASP.Net C# with a SQL Server database.

Drop down list and text box to search in database but it does not find Arabic letters.

Does any one have a solution please?

Here is my code with the SQL statement

void GetContact(string column, string keyword)
{
    con.Open();
    SqlCommand com = new SqlCommand();
    com.Connection = con;
    com.CommandType = CommandType.Text;
    com.CommandText = "SELECT * FROM Contact WHERE " + column +" LIKE '%" + keyword + "%'";
    SqlDataReader data = com.ExecuteReader();
    gvContact.DataSource = data;
    gvContact.DataBind();
    con.Close();
}

Upvotes: 0

Views: 3441

Answers (1)

Rahul Sharma
Rahul Sharma

Reputation: 453

You should use the N' prefix to indicate that you're searching for a Unicode string:

SELECT * 
FROM dbo.tblArticle 
WHERE name LIKE N'%......%'

Upvotes: 2

Related Questions