ASP Call MySQL 5.1 Chinese garbled

Source: Internet
Author: User
Tags character set config insert odbc sql mysql mysql database

There is a small program with a MySQL database, in the Chinese garbled this piece made the day more confused, the result was put down. These two days there is a dream in research, the results are also made right, hehe.

Previous steps after installing MySQL, the configuration of the selection of MySQL Server Instance Config Wizard-> detail option was selected at the time of the code for GB2312, do not know why there are garbled.

This time, a different step:

1. Install MySQL 5.1, do not have MySQL Server Instance config Wizard configuration, choose stand option to configure. After entering the MySQL display Chinese garbled, insert Chinese garbled set names gb2312 after the solution.

2. Install MySQL ODBC 5.1.

3. Install MySQL Front for connection character Set selection gb2312 colaction select Gb2312_chinese_ci.

When you create a table, you use gb2312 to encode the field.

<%
Set Conn=server.createobject ("Adodb.connection")

connectionstring= "Driver={mysql ODBC 5.1 driver};d atabase=mysql;server=localhost;uid=root;password=abc;opt=3;smt= SET NAMES ' gb2312 '
Conn.Open ConnectionString

Set Rs=server.createobject ("Adodb.recordset")
Rs.Open "Select from Testme", conn,1,1
While not rs.eof
Response.Write RS ("username")
Rs.movenext
Wend
Rs.close
Set rs=nothing

Sql= "INSERT into Testme (username) VALUES (' China ')"
Conn.execute SQL
%>

This will not appear garbled.



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.