title: How to write UTF8 text to MySQL from ASP.NET via ODBC?
body: <p>I'm using MySQL 5 on shared hosting, connecting from ASP.NET 3.5 using the MySQL 5.1 ODBC driver. I'd like to store UTF8 strings. My tables used to be all in "latin1_swedish_ci", but I converted the the database, table, and column to UTF8 using:</p>
  
  <pre><code>ALTER DATABASE `my_db` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ;
  ALTER TABLE `my_table`  DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ;
  ALTER TABLE `my_table` CHANGE `subject` `subjext` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL
  </code></pre>
  
  <p>But I still get this error when inserting non-ascii characters (like "遊ぶ"）into my database using an ODBCConnection and ODBCCommand:</p>
  
  <p><code>ERROR [HY000] [MySQL][ODBC 5.1 Driver][mysqld-5.0.51b-community-nt]Incorrect string value: '\xE3\x80\x80\xE6\x89\x8B...' for column 'subject' at row 1</code></p>
  
  <p>Note that since I'm using the 5.1 driver, I can't use "SET NAMES utf8;" - it produces an error.</p>
  
  <p>Any ideas what I'm missing?</p>