When inserting Chinese data into mysql5.0 on the page, the system prompts "failed". Copy the SQL statement to the manager, and the database prompts "data too long for column" title ". I changed it to a Chinese character, the system still prompts the same information. Change it to English and try again. Normally, it should be a character set except for the problem, but the DEFAULT_CHARSET selected by the database during database creation should be a field problem.
Configure the character set in the my. ini file in the MySQL installation directory as follows (after modification, restart the MySQL Service ):
[Mysql]
Default-character-set = gbk
[Mysqld]
Default-character-set = gbk
Or find
SQL-mode = "STRICT_TRANS_TABLES, NO_AUTO_CREATE_USER, NO_ENGINE_SUBSTITUTION"
Put
STRICT_TRANS_TABLES,
Remove and restart mysql.
Change the character set attribute of the table and field to gbk.
In each MySqlCommand Execute statement, if the SQL statement or parameter contains Chinese characters, or the returned record contains Chinese characters (the Select query statement ), add a set names gbk before the Execute SQL statement ;.
Reprinted: http://www.blogjava.net/zoninge/archive/2009/04/15/265663.html