Unable to save chinese character in mysql db. RRS feed

  • Question

  • User944339287 posted

    hi guys, i having problem to save chinese character (unicode) in mysql database. appearing ?? in corresponding column.

    below is my connection string, i have set accordingly.

    DRIVER={MySQL ODBC 3.51 Driver};SERVER=localhost;DATABASE=db_testing;UID=db_username;PASSWORD=db12345;Character Set=utf8;OPTION=3;

    below is my sql command

    Dim success As Boolean
    Dim Added As Integer
    Str = "UPDATE product_detail SET desc2 = '" + desc2 + "'"
    cmd.CommandText = Str
        Added = cmd.ExecuteNonQuery()
        success = True
    Catch ex As Exception
        success = False
        errormsg = ex.Message
        If Not MyConn Is Nothing Then
        End If
    End Try
    Return success

    below is my table structure

    Saturday, September 7, 2013 3:47 AM

All replies

  • User944339287 posted

    hi guys, any advise on my problem? tq

    Sunday, October 20, 2013 12:50 AM
  • User1508394307 posted

    I think in connection string it must be "Charset=utf8;" and not "Character Set=utf8;"


    Try to add N-prefix when using in update command

    Str = "UPDATE product_detail SET desc2 = N'" + desc2 + "'"

    Sunday, October 20, 2013 5:40 AM
  • User944339287 posted

    hi smirnov,

    I have changed to Charset=utf8; as well as using N-prefix in update command.

    But the chinese character displaying ???? in mysql database. any advise?

    Thursday, October 24, 2013 12:22 AM