Description:
If I use SQL insert into mysql admin page, the SQL command
as follows :
CREATE TABLE IF NOT EXISTS `Category` ( `Categorycode` varchar( 50) COLLATE
utf8_unicode_ci NOT NULL, `Desc1` varchar( 50) COLLATE utf8_unicode_ci NOT NULL, `Desc2`
varchar( 50) COLLATE utf8_unicode_ci NOT NULL, `Desc3` varchar( 50) COLLATE
utf8_unicode_ci NOT NULL, `Desc4` varchar( 50) COLLATE utf8_unicode_ci NOT NULL, `ISN`
varchar( 20) COLLATE utf8_unicode_ci NOT NULL, `Ordering` varchar( 10) COLLATE
utf8_unicode_ci NOT NULL, `StockNotes` varchar( 200) COLLATE utf8_unicode_ci NOT NULL,
`Worth` float NOT NULL , `LastLog` varchar( 20) COLLATE utf8_unicode_ci NOT NULL)
ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; INSERT INTO `Category` (
`Categorycode`, `Desc1`, `Desc2`, `Desc3`, `Desc4`, `ISN`, `Ordering`, `StockNotes`,
`Worth`, `LastLog`) VALUES ( 'try1cat', 'BAMBOO CAN 竹筒', '-', '-', '-', '-', '-',
'-', 0, '-')"
The chinese charaxter '竹筒' displayed.
But if I download mySQL Net Connector (I tried with 5.0, 5.2, 6.2.2) and start a project with VB2008, add reference for MYSQL Net Connector 6.2.2 dll and execute the same sql using :
Dim i As Integer
Dim cmd As New MySqlCommand
cmd.CommandText = sqlstr
cmd.CommandType = Data.CommandType.Text
cmd.Connection = New MySqlConnection(connectionString)
cmd.Connection.Open()
i = cmd.ExecuteNonQuery()
The chinese character appears as ??
How to repeat:
Create a database, start vs2010, create a new project, add new reference for 6.2.2 dll
dim connectionstring = "......"
dim sqlstr = _
CREATE TABLE IF NOT EXISTS `Category` ( `Categorycode` varchar( 50) COLLATE
utf8_unicode_ci NOT NULL, `Desc1` varchar( 50) COLLATE utf8_unicode_ci NOT NULL, `Desc2`
varchar( 50) COLLATE utf8_unicode_ci NOT NULL, `Desc3` varchar( 50) COLLATE
utf8_unicode_ci NOT NULL, `Desc4` varchar( 50) COLLATE utf8_unicode_ci NOT NULL, `ISN`
varchar( 20) COLLATE utf8_unicode_ci NOT NULL, `Ordering` varchar( 10) COLLATE
utf8_unicode_ci NOT NULL, `StockNotes` varchar( 200) COLLATE utf8_unicode_ci NOT NULL,
`Worth` float NOT NULL , `LastLog` varchar( 20) COLLATE utf8_unicode_ci NOT NULL)
ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; INSERT INTO `Category` (
`Categorycode`, `Desc1`, `Desc2`, `Desc3`, `Desc4`, `ISN`, `Ordering`, `StockNotes`,
`Worth`, `LastLog`) VALUES ( 'try1cat', 'BAMBOO CAN 竹筒', '-', '-', '-', '-', '-',
'-', 0, '-')"
Dim i As Integer
Dim cmd As New MySqlCommand
cmd.CommandText = sqlstr
cmd.CommandType = Data.CommandType.Text
cmd.Connection = New MySqlConnection(connectionString)
cmd.Connection.Open()
i = cmd.ExecuteNonQuery()
Suggested fix:
amend the 6.2.2 source to handle the sent in utf-8 characters
Description: If I use SQL insert into mysql admin page, the SQL command as follows : CREATE TABLE IF NOT EXISTS `Category` ( `Categorycode` varchar( 50) COLLATE utf8_unicode_ci NOT NULL, `Desc1` varchar( 50) COLLATE utf8_unicode_ci NOT NULL, `Desc2` varchar( 50) COLLATE utf8_unicode_ci NOT NULL, `Desc3` varchar( 50) COLLATE utf8_unicode_ci NOT NULL, `Desc4` varchar( 50) COLLATE utf8_unicode_ci NOT NULL, `ISN` varchar( 20) COLLATE utf8_unicode_ci NOT NULL, `Ordering` varchar( 10) COLLATE utf8_unicode_ci NOT NULL, `StockNotes` varchar( 200) COLLATE utf8_unicode_ci NOT NULL, `Worth` float NOT NULL , `LastLog` varchar( 20) COLLATE utf8_unicode_ci NOT NULL) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; INSERT INTO `Category` ( `Categorycode`, `Desc1`, `Desc2`, `Desc3`, `Desc4`, `ISN`, `Ordering`, `StockNotes`, `Worth`, `LastLog`) VALUES ( 'try1cat', 'BAMBOO CAN 竹筒', '-', '-', '-', '-', '-', '-', 0, '-')" The chinese charaxter '竹筒' displayed. But if I download mySQL Net Connector (I tried with 5.0, 5.2, 6.2.2) and start a project with VB2008, add reference for MYSQL Net Connector 6.2.2 dll and execute the same sql using : Dim i As Integer Dim cmd As New MySqlCommand cmd.CommandText = sqlstr cmd.CommandType = Data.CommandType.Text cmd.Connection = New MySqlConnection(connectionString) cmd.Connection.Open() i = cmd.ExecuteNonQuery() The chinese character appears as ?? How to repeat: Create a database, start vs2010, create a new project, add new reference for 6.2.2 dll dim connectionstring = "......" dim sqlstr = _ CREATE TABLE IF NOT EXISTS `Category` ( `Categorycode` varchar( 50) COLLATE utf8_unicode_ci NOT NULL, `Desc1` varchar( 50) COLLATE utf8_unicode_ci NOT NULL, `Desc2` varchar( 50) COLLATE utf8_unicode_ci NOT NULL, `Desc3` varchar( 50) COLLATE utf8_unicode_ci NOT NULL, `Desc4` varchar( 50) COLLATE utf8_unicode_ci NOT NULL, `ISN` varchar( 20) COLLATE utf8_unicode_ci NOT NULL, `Ordering` varchar( 10) COLLATE utf8_unicode_ci NOT NULL, `StockNotes` varchar( 200) COLLATE utf8_unicode_ci NOT NULL, `Worth` float NOT NULL , `LastLog` varchar( 20) COLLATE utf8_unicode_ci NOT NULL) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; INSERT INTO `Category` ( `Categorycode`, `Desc1`, `Desc2`, `Desc3`, `Desc4`, `ISN`, `Ordering`, `StockNotes`, `Worth`, `LastLog`) VALUES ( 'try1cat', 'BAMBOO CAN 竹筒', '-', '-', '-', '-', '-', '-', 0, '-')" Dim i As Integer Dim cmd As New MySqlCommand cmd.CommandText = sqlstr cmd.CommandType = Data.CommandType.Text cmd.Connection = New MySqlConnection(connectionString) cmd.Connection.Open() i = cmd.ExecuteNonQuery() Suggested fix: amend the 6.2.2 source to handle the sent in utf-8 characters