There are two solutions:
One is to set it before the execution statement, such as:
Copy the codeThe code is as follows:
MySQLCommand mCommand = new MySQLCommand("set names gb2312", m_Connection);
Another type is to be added directly into the connection string, such as:
Copy the codeThe code is as follows:
<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, which solved the problem very simply.