c # mysql database when the operation will insert Chinese characters become question marks?

Scene: There is no problem in the implementation of mysql ce inside.

c # operation there will be a question mark.

 

The reason is: when the connection string to set Charset = utf8; otherwise it will by default set the encoding server, usually go wrong.

 

  Check: 1, the database is created by utf8 encoding format. 2, the table is utf8 format.

3, the link string increases Charset = utf8;

such as:

<add name="mysql" connectionString="server=localhost;user id=root;password=123456;persistsecurityinfo=True;database=test1;Allow User Variables=True;Charset=utf8;"
providerName="MySql.Data.MySqlClient" />

 

The perfect solution!

Guess you like

Origin www.cnblogs.com/zxs-onestar/p/11139764.html