No Problem reading Unicode, but can't insert Unicode through C#
Posted by: Daniel Kwan
Date: May 20, 2008 01:58PM

I was very pleased with Unicode support in MySQL 5.x . I could mix and match Japanese, Traditional Chinese and Simplified Chinese characters in a single nvarchar field. I could insert records using Navicat and then read them back from MySQL Query Browser. I can even read all these Unicode character using C# and Connector/N with no problem.

Trouble comes when I try to INSERT records into the table. All the Unicode characters turned into question marks. Since Unicode worked fine when I insert records into MySQL 5 with MySQL Query Browser, the issue should be on Connect/N.

I used direct SQL statement like this in C# (2.0):


command.CommandText = "INSERT INTO DiscCatalog (Disk, Name, Path, FullPath, Size, Date, Time, Category, Level, Files, Type) VALUES ('ペ', '尊重', 'ペ', '风云榜', '50 000 000', '5/12/2006', '13:29:30 PM', '', 3, 0, 'File')";
command.ExecuteNonQuery();

So do I need to explicitly do anything to tell MySqlCommand that the CommandText is a Unicode string?

Options: ReplyQuote


Subject
Written By
Posted
No Problem reading Unicode, but can't insert Unicode through C#
May 20, 2008 01:58PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.