C mysql insert data Chinese garbled code solution
- 2020-05-19 05:39:21
- OfStack
There are two solutions:
1 is set before the execution statement, such as:
MySQLCommand mCommand = new MySQLCommand("set names gb2312", m_Connection);
The other is added directly to the connection string, such as:
<add name="connection" connectionString="server=127.0.0.1;UId=root;PassWord=root;Persist Security Info=True;database=test;Charset=utf8;" providerName="MySql" />
I used the second one, and I solved the problem very simply.