Microsoft VBScript 运行时错误 (0x800A01A8)缺少对象: '[string: "D:\test\db1.mdb"]'

来源:百度知道 编辑:UC知道 时间:2024/05/30 09:17:32
错误类型:
Microsoft VBScript 运行时错误 (0x800A01A8)
缺少对象: '[string: "D:\test\db1.mdb"]'
/test/conn.asp, 第 3 行

test.asp代码如下:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="conn.asp"-->
<!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>
<%
set sql1 = "selete * from score"
set rs = Server.CreateObject

你把select写成了selete了

conn.asp换

<%
starttime=timer()
StrSQL="DBQ="+server.mappath("db1.mdb")+";DRIVER={Microsoft Access Driver (*.mdb)};"
set conn=server.createobject("ADODB.CONNECTION")
conn.open StrSQL
%>

呵呵,刚才多写了个SET,这样绝对没有问题了
<%
sql1="select * from score"
set rs=server.createobject("adodb.recordset")
rs.open sql1,conn,3,3

Response.Write("学号:"&rs("xuehao")&"<br>")
Response.Write("姓名:"&rs("xingming")&"<br>")
conn.Close
set rs = Nothing
set Conn = Nothing
%>

绝对路径和相对路径没有处理好吧

错误在conn.asp 里 没有找到数据库之类的问题.