求助: asp错误类型: ADODB.Recordset (0x800A0CC1) 在对应所需名称或序数的集合中,未找到项目。
test.asp<%@LANGUAGE="VBSCRIPT"CODEPAGE="65001"%><!--#includefile="inc/xsda.mdb"--><!-...
test.asp
<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<!--#include file="inc/xsda.mdb"-->
<!--#include file="inc/function.asp"-->
<%
dim dbxs
set dbxs=Server.CreateObject("ADODB.Connection")
dbxs.Open= "provider=microsoft.jet.oledb.4.0;" & "data source = " & server.mappath("inc/xsda.mdb")
dim strSql,rs
strSql="Select*From xsda"
set rs=dbxs.Execute (strSql)
%>
<!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=utf-8" />
<title>无标题文档</title>
</head>
<body>
<table width="200" border="1">
<tr>
<td><% call showtable(rs) %></td>
</tr>
</table>
</body>
</html>
function.asp
function showtable(rs)
response.Write("<table border=1>")
response.Write("tr")
for i=1 to rs.fields.count
response.Write("<td>"+rs(i).name+"</td>")
next
response.Write("</td>")
do while rs.eof<>0
response.Write("<tr>")
for i=1 to rs.fields.count
response.Write("<td>"+rs(i)+"</td>")
next
rs.movenext()
loop
response.Write("</table>")
dbxs.close
end function 展开
<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<!--#include file="inc/xsda.mdb"-->
<!--#include file="inc/function.asp"-->
<%
dim dbxs
set dbxs=Server.CreateObject("ADODB.Connection")
dbxs.Open= "provider=microsoft.jet.oledb.4.0;" & "data source = " & server.mappath("inc/xsda.mdb")
dim strSql,rs
strSql="Select*From xsda"
set rs=dbxs.Execute (strSql)
%>
<!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=utf-8" />
<title>无标题文档</title>
</head>
<body>
<table width="200" border="1">
<tr>
<td><% call showtable(rs) %></td>
</tr>
</table>
</body>
</html>
function.asp
function showtable(rs)
response.Write("<table border=1>")
response.Write("tr")
for i=1 to rs.fields.count
response.Write("<td>"+rs(i).name+"</td>")
next
response.Write("</td>")
do while rs.eof<>0
response.Write("<tr>")
for i=1 to rs.fields.count
response.Write("<td>"+rs(i)+"</td>")
next
rs.movenext()
loop
response.Write("</table>")
dbxs.close
end function 展开
1个回答
展开全部
for i=1 to rs.fields.count
response.Write("<td>"+rs(i).name+"</td>")
next
改成
for i=0 to rs.fields.count-1
response.Write("<td>"+rs(i).name+"</td>")
next
response.Write("<td>"+rs(i).name+"</td>")
next
改成
for i=0 to rs.fields.count-1
response.Write("<td>"+rs(i).name+"</td>")
next
追问
for i=0 to rs.fields.count-1
response.Write(""+rs(i).name+"")
next
这个不能显示?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询