mysql administrator 中配置了默认字符集gb2321,表中涉及中文的列也是gb2321,在mysql administrator能正确显示中文,关闭数据库再打开也是正常,但输出到vb,用debug.print 显示乱码,输出到list控件也是乱码,怎么搞啊?
顺便还提个问题,难道mysql仅支持 rs.Fields(6).Value ,而不支持 rs.Fields(“列名”).Value的表达式,我再vb中用后者老师报错!

解决方案 »

  1.   

    连接MYSQL的字串中设置字符集没有?MYSQL 的INI、CNF的字符集设置是什么?
      

  2.   

    部分代码如下:
    connstr = "DRIVER={MySQL ODBC 3.51 Driver};SERVER=127.0.0.1;port=3306;DATABASE=test;UID=root;PWD=root;OPTION=3"
    '打开连接
    conn.Open connstr
    sql = "select * from dian1"
    Set rs = conn.Execute(sql)
    While Not rs.EOF
              Debug.Print rs.Fields(6).Value
              Debug.Print rs.Fields("填表人")
              rs.MoveNext
      Wend
    在哪里设置字串字符集?
    Debug.Print rs.Fields
    这句报错!# The following options will be read by MySQL client applications.
    # Note that only client applications shipped by MySQL are guaranteed
    # to read this section. If you want your own MySQL client program to
    # honor these values, you need to specify it as an option during the
    # MySQL client library initialization.
    #
    [client]port=3306[mysql]default-character-set=gb2321
    # SERVER SECTION
    # ----------------------------------------------------------------------
    #
    # The following options will be read by the MySQL Server. Make sure that
    # you have installed the server correctly (see above) so it reads this 
    # file.
    #
    [mysqld]# The TCP/IP Port the MySQL Server will listen on
    port=3306
    #Path to installation directory. All paths are usually resolved relative to this.
    basedir="C:/Program Files/MySQL/MySQL Server 5.0/"#Path to the database root
    datadir="C:/Program Files/MySQL/MySQL Server 5.0/Data/"# The default character set that will be used when a new schema or table is
    # created and no character set is defined
    default-character-set=gb2312
      

  3.   

    呵呵,功夫不负有心人,原来mysql5的版本要用MySQL ODBC 5.1 Driver的,原来的3.51不行,乱码随之解决。
      

  4.   

    就是odbc版本问题。我哭。。两个问题都解决!