Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. MySQL inserting UnicodeStr

MySQL inserting UnicodeStr

Scheduled Pinned Locked Moved C#
questiondatabasemysqlannouncement
5 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    pnpfriend
    wrote on last edited by
    #1

    Hi All, I have a unicode string string tempstr = "פסטיבל סגול ה- 11 - למדיטציה ואהבה"; odbcCmd.Text = "update myTable set testField '" + tempstr + "' where myIndex=3"; odbcCmd.ExecuteNonQuery(); After I run ExecuteNonQuery(), I found '???????' in the testField instead of Hebrew chars. I also tested out with languages other than English, it is inserting '????' instaead of unicode string. However, I run that Update string in the mySQL browser (not using any program), it inserted info/nicode string correctly. Why is it? I look at the field properties and it was set to utf8. how can I insert non-english characters ino db please. Thank You.

    G 1 Reply Last reply
    0
    • P pnpfriend

      Hi All, I have a unicode string string tempstr = "פסטיבל סגול ה- 11 - למדיטציה ואהבה"; odbcCmd.Text = "update myTable set testField '" + tempstr + "' where myIndex=3"; odbcCmd.ExecuteNonQuery(); After I run ExecuteNonQuery(), I found '???????' in the testField instead of Hebrew chars. I also tested out with languages other than English, it is inserting '????' instaead of unicode string. However, I run that Update string in the mySQL browser (not using any program), it inserted info/nicode string correctly. Why is it? I look at the field properties and it was set to utf8. how can I insert non-english characters ino db please. Thank You.

      G Offline
      G Offline
      Giorgi Dalakishvili
      wrote on last edited by
      #2

      Have a look at this: Mysql Unicode[^]

      #region signature my articles #endregion

      P 1 Reply Last reply
      0
      • G Giorgi Dalakishvili

        Have a look at this: Mysql Unicode[^]

        #region signature my articles #endregion

        P Offline
        P Offline
        pnpfriend
        wrote on last edited by
        #3

        Thank You Giorgi, I looked at the link you gave it to me and I tried it. My TableOptions are following: MyISAM Storage Engine, Charset=utf8, Collation= Utf8_general_ci I tried with following two myConnection strings 1) cnnString = "DRIVER={MySQL ODBC 3.51 Driver};SERVER=imagingsql01;UID=roscoe; PASSWORD=roscoe;OPTION=3; Data Source=localhost; Persist Security Info=yes;character set=utf8;Database=myDBName;";//CHARSET=utf8;"; 2) cnnString = "DRIVER={MySQL ODBC 3.51 Driver};SERVER=imagingsql01;UID=roscoe; PASSWORD=roscoe; OPTION=3; Data Source=localhost; Persist Security Info=yes;CHARSET=utf8;Database=myDBName;"; I tried both ways and still inserting '??????' to the table. What else do I need to do to the table/code so the inserting can be done in proper way. Thanks.

        G 1 Reply Last reply
        0
        • P pnpfriend

          Thank You Giorgi, I looked at the link you gave it to me and I tried it. My TableOptions are following: MyISAM Storage Engine, Charset=utf8, Collation= Utf8_general_ci I tried with following two myConnection strings 1) cnnString = "DRIVER={MySQL ODBC 3.51 Driver};SERVER=imagingsql01;UID=roscoe; PASSWORD=roscoe;OPTION=3; Data Source=localhost; Persist Security Info=yes;character set=utf8;Database=myDBName;";//CHARSET=utf8;"; 2) cnnString = "DRIVER={MySQL ODBC 3.51 Driver};SERVER=imagingsql01;UID=roscoe; PASSWORD=roscoe; OPTION=3; Data Source=localhost; Persist Security Info=yes;CHARSET=utf8;Database=myDBName;"; I tried both ways and still inserting '??????' to the table. What else do I need to do to the table/code so the inserting can be done in proper way. Thanks.

          G Offline
          G Offline
          Giorgi Dalakishvili
          wrote on last edited by
          #4

          Which driver are you using to connect to Mysql? Also, check this link: http://dev.mysql.com/doc/refman/5.0/en/faqs-cjk.html[^]

          #region signature my articles #endregion

          P 1 Reply Last reply
          0
          • G Giorgi Dalakishvili

            Which driver are you using to connect to Mysql? Also, check this link: http://dev.mysql.com/doc/refman/5.0/en/faqs-cjk.html[^]

            #region signature my articles #endregion

            P Offline
            P Offline
            pnpfriend
            wrote on last edited by
            #5

            I am using 4.1.10a-nt-max after I called Select Version();

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups