How to insert arabic characters into sql database?

前端 未结 1 991
无人共我
无人共我 2020-12-01 11:02

How can I insert arabic characters into sql database? I tried to insert arabic data into a table and the arabic characters in the insert script were inserted as \'????

相关标签:
1条回答
  • 2020-12-01 11:34

    For the field to be able to store unicode characters, you have to use the type nvarchar (or other similar like ntext, nchar).

    To insert the unicode characters in the database you have to send the text as unicode by using a parameter type like nvarchar / SqlDbType.NVarChar.

    (For completeness: if you are creating SQL dynamically (against common advice), you put an N before a string literal to make it unicode. For example: insert into table (name) values (N'Pavan').)

    0 讨论(0)
提交回复
热议问题