注册 登录
编程论坛 ASP技术论坛

用asp读取数据库的问题

啊呀呀 发布于 2007-11-30 22:03, 521 次点击
我用读取来连接数据库,可是显示出来都是乱码,有哪位大虾能告诉我这是为什么?
<!--#include file="a.mdb"-->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=bg2312" />
<title>无标题文档</title>
</head>
<body>
<%
set conn=server.createobject("adodb.connection")
conn.open "driver={microsoft access driver (*.mdb)};dbq="&server.mappath("a.mdb")
%>
<%
exec="select * from b"
set rs=server.createobject("adodb.recordset")
rs.open exec,conn,1,1
%>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<%do while not rs.eof%><tr>
<td><%=rs("name")%></td>
<td><%=rs("pass")%></td>
<td><%=rs("message")%></td>
</tr><%
rs.movenext
loop
%>
</table>
</body>
</html>
以上是我打的代码,其中a是数据库名称,b是表的名称,本人菜鸟级的,请说的详细点,在这里先谢了。
1 回复
#2
madpbpl2007-12-01 00:03
charset=bg2312
换成
charset=gb2312
试试
1