<%
‘‘‘‘‘‘下载驱动文件
‘‘‘‘‘‘https://dev.mysql.com/get/Downloads/Connector-ODBC/3.51/mysql-connector-odbc-3.51.30-winx64.msi 文件下载地址
‘‘‘‘‘‘‘gb2312 utf8 gbk
Dim conn, connstr, mycharset,strquery
mycharset = "utf8"
connstr="driver={mysql odbc 3.51 driver};database=qf_jzw;server=localhost;uid=root;password=root"
set conn=Server.CreateObject("adodb.connection")
conn.open connstr
conn.execute("set names ‘" & mycharset & "‘")
‘不加上面语句汉字部分可能会出现???乱码
%>
<%
strquery = "select * from qf_info limit 5,5"
Set rs = Server.CreateObject("Adodb.RecordSet")
rs.open strquery, conn, 1, 1
‘set rs = conn.execute(strquery)
if not rs.bof then
%>
<table>
<%
do while not rs.eof
%>
<tr>
<td>编号</td>
<td>标题</td>
</tr>
<tr>
<td><%=rs("id")%></td>
<td><%=rs("title")%></td>
</tr>
<%
rs.movenext
Loop
%>
</table>
<%
else
Response.Write("无数据!")
End if
rs.close
Set rs=Nothing
conn.Close
Set conn=Nothing
%>
原文地址:https://www.cnblogs.com/thinkbig/p/10074161.html