i'm using Visual Studio 2010(c#) for a winapp i'm writing.
i have a DataBase in which i have 6 tables and there are so many fields in them that use unicode characters( Persian) and all of them are nvarchar(n) type cuz i had problem with text earlier, but when i want to search in them every thing works fine but one letter ( the equivalent for Y in Persian and Arabic which is 2 characters) but the search queries recognize neither of them in some fields and in some other only the Arabic letter but my language is Persian and it's kinda messed up. and not forget to say that i only have this problem when i use direct commands on DB, but when i use a data set or data table there is no problem like that. where can i access the options for unicode and such in sql? thanks to those who answer. my work has come to a dead lock.

Recommended Answers

All 3 Replies

When you work on a DataSet or DataTable you are using native .Net types and the strings are unicode which is why your searches work.

When you construct your commands in SQL do your build the command string manually in code or do you use SqlParameters to load the values?
If the former then this could the source of your problem.
Try passing the comparison strings using SqlParameters. This might fix things.
(No guarantees, I am no expert on text localisation in SQL).

thanks mate but passing the values with parameters didn't work either. I'm really stuck here so if any one even thinks that some thing might work plz tell me. and were can i change the setting that I've set when i was installing the sql server?

Please show a code example that works (i.e. use a data set or data table)
and a code example that does not work (i.e. use direct commands on DB).
This way someone might be able to detect where the differences are between the two methods.

The problem is most likely to do with regional settings or code pages but I am no expert on this as I only ever work in English.

I found this page that has info about SQL and .Net culture/language information and how it affects dates.
Not sure if this is affecting your search queries or not.:idea:

I will help as much as I can but would appreciate any input from anyone that has better experience working with different languages with SQL.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.