SQL query in C # does not support Hebrew

I have a problem when I make a Hebrew SQL query:

"select ProductName From Products WHERE TypeOfProduct ='מעבד'"

I have TypeOfProductset that have the value "מעבד", but the query returns null.

If you replace the Hebrew word with something like numbers or English words, everything will be fine.

How to use Hebrew in SQL queries?

+5
source share
1 answer

You must use Unicode using the prefix "N" before the string, that is, N 'מעבד' in your where clause ...

    select ProductName From Products WHERE TypeOfProduct = N'מעבד'

You also need to make sure your column is of type nvarchar, not varchar.

If you cannot use string nvarcharand Unicode, you will have to change the database setting from LATINto HEBREW.

+12
source

All Articles