Microsoft OLE DB Provider for ODBC Drivers 错误 '80004005'

mahongzuoye 2009-06-26 06:23:53
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>检索数据库记录子程序的代码</title>
</head>

<body bgcolor="#99FF99">
<center>
<%
set conn=server.CreateObject("adodb.connection")
conn.open "test"
set rs=server.CreateObject("adodb.recordset")
sqlstmt="select * from student"
rs.open sqlstmt,conn
if rs.eof then
response.Write("<center>数据库中没有记录,")
response.Write("<br>请检查数据库!</center>")
else
%>
<h1><b><i>检索数据库记录的例子</i></b></h1>
<hr>
<table width="603" border="1" cellpadding="10" height="10">
<tr><td align="center" width="143"><b><font size="+1" color="#000000">姓名</font></b></td>
<td bgcolor="#0066FF" align="center" width="108">
<b>
<font size="+1" color="#000000">性别</font>
</b>
</td>
<td width="126" valign="top" align="center">
<font size="+1"><b>班级</b></font>
</td>
<td width="126" valign="top" align="center">
<font size="+1"><b>成绩</b></font>
</td>
</tr>
<%
do while not rs.eof
name=rs("name")
classname=rs("class")
sex=rs("sex")
score=rs("score")
%>
<tr>
<td height="1" width="143" align="center">
<%=name%>
</td>
<td height="1" width="108" bgcolor="#99FF00" align="center">
<font size="+3"><font color="#000000"><b>
<%=sex%></b></font></font></td>
<td height="1" width="126" align="center"><font size="+3"><b><%=classname%></b></font></td>
<td height="1" width="126" align="center"><font size="+3"><b><%=score%></b></font></td>
</tr>
<%
rs.movenext
loop
rs.close
set rs=nothing
conn.close
set conn=nothing
end if
%>
</table>
</center>

</body>
</html>

数据库:"student.mdb"已经驱动了,可是运行出错conn后面接数据库名吗?还是目录文件名:
Microsoft OLE DB Provider for ODBC Drivers 错误 '80004005'

[Microsoft][ODBC 驱动程序管理器] 未发现数据源名称并且未指定默认驱动程序

/lx/626/list.asp,行 13

...全文
54 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
hookee 2009-06-26
  • 打赏
  • 举报
回复
conn.open "test" 这样写的话test是DSN的名字。 通过 开始-管理工具-数据源ODBC 设置

28,406

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧