为何ASP访问Access数据库没有返回值
问题描述:一下红色部分的代码为何在执行过程中为何得不到任何数据,我在access数据库中运行得到如下如,也就是有结果的。
本人初入门选手,好多东西都不是很懂 ,请大侠们帮忙解决下为何 使用response.write(rst(0))不能得到结果,我明明数据库中是有数据的,其中,systemid=SW
conn.asp代码
<%
on error resume next
set conn=Server.CreateObject("Adodb.Connection")
conn.open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & server.MapPath("../rdcenter.mdb")
%>
index.asp代码
<!--#include file="conn.asp"-->
<!--#include file="noview.asp"-->
<%
response.charset = "GB2312"
Response.ExpiresAbsolute = Now() - 1
Response.Expires = 0
Response.CacheControl = "no-cache"
Response.AddHeader "Pragma", "No-Cache"
if session("userid") = "" or isnull(session("userid")) then
session("userid") = "guest"
session("username") = "游客"
session("userrole") = "GUEST"
end if
systemid=request("systemid")
node=request("node")
pnode=request("pnode")
'response.Write(systemid)
'response.Write(node+"测试")
'response.Write(pnode)
set rst = server.createobject("adodb.recordset")
sql = "select id,text,parentid from s_tree where systemid='"&systemid&"' and isroot='Yes'"
'response.Write(sql)
rst.open sql,conn,1,1
response.Write(rst(0))
if not rst.eof then
roottext = rst(1)
response.Write(rst(1)&"int")
if node = "" and pnode = "" then
node = rst(0)
pnode=rst(2)
response.Write(node)
response.Write("2")
end if
else
response.write "<script language=javascript>"
response.write "history.go(-1);"
response.write "</script>"
end if
rst.close
set rst = nothing
set rst = server.createobject("adodb.recordset")
sql = "select treewidth from s_treeset where systemid='"&systemid&"'"
rst.open sql,conn,1,1
if not rst.eof then
treewidth=rst(0)
end if
rst.close
set&nbs