Chinese character are written as question marks in the SQL database
I am using ADO.net
to write a string to a field in a table of Microsoft SQL Server 2005 database.
I am using SqlBulkCopy::WriteToServer
api to write to SQL database.
The data type of the column in Sql database 开发者_Python百科table is of type varchar2
.
If I change the datatype to nvarchar the chinese characters are written properly. But I think it should work with data type varchar2
also.
There is no VARCHAR2
data type in SQL Server - you must use NVARCHAR
.
VARCHAR2
exists in Oracle (and possibly other database platforms).
You have to mention that Varchar2
doesnot exist in SQL and youhave to use NVARCHAR
.
By the way your problem is not belong to it, it is because of SQL Collasion, when You (or admin) were installing the SQL Server, you set Chinese as the collasion. so when SQL cannot find an equevalent for a character, then replace it with a chinese character.
精彩评论