7

Actually before i did not use framework or linq, just type in sql statement with Sqlcommand class, i type in insert into table values(N'sample') actually i donot know what is N, but it works for Chinese and other Language, otherwise, it will insert some question mark.

But when i use EntityFramework,this kind of framework always insert some question mark, can i ask how to tackle the issue.

N means Unicode? Can you give me one example that EntityFramework use that sort of thing?

stackover
  • 122
  • 1
  • 7

4 Answers4

5
  1. in .edmx Table, select column -> check its properties and set unicode to true
  2. re-generate table if you are working in Code First Apporach
  3. check your database table, it should be nvarchar or ntext datatype

this way EF will save unicode characters.

enter image description here

Saboor Awan
  • 1,537
  • 4
  • 24
  • 36
2

I had exact same problem for Nepali Language. I had to convert the datatype of sql server column from varchar to nvarchar and then refresh my *.edmx file in entity framework mapping. Then it worked fine.

varchar(255) => nvarchar(255)

varchar(MAX) => nvarchar(MAX)

Right click on that table mapping in edmx file and refresh. Save the changes.

merazuu
  • 3,948
  • 6
  • 17
  • 19
0

Make sure you have the language packs installed on the server that holds sqlserver for Chinese.

DRobertE
  • 3,388
  • 3
  • 24
  • 43
0

we just changed the datatype to nchar() or nvarchar and it worked. It was able to store the data in any language other then English.