I’m using connection string in my ASP.net but its showing question mark as my entry in Arabic language, how I can convert the entry to work properly.
<add name="myodbc"
connectionString="Provider=SQLOLEDB;Data Source=xxx;Initial Catalog=xxx;User ID=xxx;Password=xxx;" />
Answers:
Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.
Method 1
only you need to add ‘N’ IN STATMENT
insert into [xx].[dbo].[xx] (Name,Email,Telephone,Type_of_donation,donation_country,donation_category,transaction_time,payment_method,amount,referance_number) values ('','','',N'غير مشروط','xx','','xx','xx','32','16')
and i using this method also
store arabic in SQL database
Method 2
As a SQL developer, you should use Unicode data types in applications. The Unicode data types are nchar, nvarchar, and ntext.
These data types use Unicode character representation. Code pages do not apply to these data types. Using Unicode data types gives you the ability to deal with Arabic data even the system collation is not Arabic.
When using Unicode data types, the best way to save your Arabic data from corruption when inserting, and updating is to add capital N before your Arabic string otherwise if the default database collation is not Arabic your data will be corrupted. When using N prefix with Unicode data types you save your Arabic data regardless the default database collation is Arabic or not. This is the golden key to deal with Unicode data types in the applications like VB, or ASP, even inside SQL server like stored procedures.
UPDATE TableName SET ColumnName = N'Arabic Text' WHERE id = 1000 INSERT INTO TableName (ColumnName) values(N’Arabic Text’)
All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0