Re: .NET, MySQL and Unicode Problem
Posted by: Richard Creer
Date: October 23, 2007 06:29AM

It can be made to work but it takes some persistance!

You need to set up your tables for Unicode specifying utf8 in all the appropriate places.

MySQL Connector .net is, at the moment, your only option.

Code like this works for me, the final piece in the puzzle being charset='utf8' in the connection string -

Dim conn As New MySqlConnection("Server=localhost;Port=3306;Database=mydb;Uid=myuser;Pwd=mypswd;charset='utf8';")
conn.Open()

Dim cmd As New MySqlCommand()
cmd.Connection = conn
cmd.CommandType = CommandType.Text

cmd.CommandText = "SET NAMES utf8;"
cmd.ExecuteNonQuery()

cmd.CommandText = "INSERT INTO `tpmvalue` SET" & _
" `Record ID` = " & CStr(myID) & _
",`Value 1` = " & UnicodeField.Text
cmd.ExecuteNonQuery()

conn.Close()

You also need a recent verion of MySQL Query Browser.

HTH

Options: ReplyQuote


Subject
Written By
Posted
Re: .NET, MySQL and Unicode Problem
October 23, 2007 06:29AM


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.