用上网上的所有方法,但是还是乱码,用PHP读取的时候就什么问题也没有,但是用asp.net读取出来就会出现问题,有没有遇到这种情况的朋友呢,请大家帮帮忙,非常感觉啊!

解决方案 »

  1.   

    打开mysql安装目录的my.ini,分别在[client]和[mysqld]中都加入default-character-set= gb2312
    新建表的时候,要把character set 和Collation分别选择为gb2312和gb2312_chinese_ci
     MySQLCommand com = new MySQLCommand("set names gb2312", conn);  
    mysql的存储字符集
      

  2.   

    数据库是以前老网站用的,我现在想把一些数据导入到sql server中你说的方法我以前也用过,就是不行啊
      

  3.   


    string connStr = ConfigurationManager.AppSettings["ConnectionString"];
                    using(MySqlConnection conn = new MySqlConnection(connStr))
                    {
                        string command = "set names utf8;select title from p8_article";
                        MySqlDataAdapter da = new MySqlDataAdapter(command, conn);
                        DataSet ds = new DataSet();
                        da.Fill(ds);
                        this.GridView1.DataSource = ds;
                        this.GridView1.DataBind();
                    }上面是我的测试代码,utf8,gb2312都不行,就是乱码的样子不一样