1.首先查看数据库里面的各种编码格式

mysql> show variables like "%char%";
+--------------------------+---------------+
| Variable_name | Value |
+--------------------------+---------------+
| character_set_client | gbk |
| character_set_connection | gbk |
| character_set_database | utf8 |
| character_set_filesystem | binary |
| character_set_results | gbk |
| character_set_server | utf8 |
| character_set_system | utf8 |
+--------------------------+-------------+

2.除了character_set_filesystem 以外,所有的编码格式统一用UTF8进行设置

SET character_set_client='utf8';

3.同时修改web.config里面的配置文件在后面加上:CharSet=utf8

<add name="dryunEntities" connectionString="metadata=res://*/BaseModel.csdl|res://*/BaseModel.ssdl|res://*/BaseModel.msl;provider=MySql.Data.MySqlClient;provider connection string="server=192.168.6.81;user id=root;password=123456;persistsecurityinfo=True;database=dryun;CharSet=utf8"" providerName="System.Data.EntityClient" /></connectionStrings>