程序错在哪里?

aha_yang 2000-06-27 05:10:00
以下是用子过程querytable来显示一个ACCESS数据库(customers.mdb)中的一个表(customers)的例子,共有两个文件sqlservertablelist.asp和lib_dbtable.asp
都放在/aspweb/database目录下,而数据库放在/aspweb/database/datasource目录下,在浏览器显示时报错:在lib_datable.asp的最后一行:end sub
我怎么也不理解这么简单的一个语句会有语法错误,显然是程序还有问题,希望高手能耐心阅读后赐教,谢谢!

SqlServerTableList.asp
<%@ Language=VBScript %>
<HTML>
<HEAD><title>SqlServerTableList.asp</title>
</HEAD>
<BODY>
<%
whichDSN="DRIVER={Microsoft Access Driver(*.mdb)};"
whichDSN=whichDSN & "DBQ=" & server.MapPath("/Aspweb/Database/datasource/customers.mdb")
call querytable("select * from customers WHERE Country=UK",whichDSN)
%>
<!--#include virtual="/aspweb/database/lib_dbtable.asp"-->
</BODY>
</HTML>


lib_dbtable.asp
<%
sub querytable(inputquery,inputDSN)
dim conntemp,rstemp
set conntemp=server.CreateObject("adodb.Connection")
conntemp.Open inputDSN
set rstemp=conntemp.Execute(inputquery)
howmanyfields=rstemp.fields.count-1
%>
<table border=1><tr>
<%
for i=0 to howmanyfields
%>

<td><b>
<%=rstemp(i).name%>
</b></td>
<%
next
%>
</tr>

<%
do while not rstemp.eof
%>
<tr>

<%
for i=0 to howmanyfields
thisvalue=rstemp(i)
If isnull(thisvalue) then
thisvalue=" "
end if
%>

<td valign=top><%=thisvalue%></td>
<%
next
%>
</tr>

<%
rstemp.movenext
%>
</table>

<%
rstemp.Close
set rstemp=nothing
conntemp.Close
set conntemp=nothing
end sub
%>

...全文
110 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
zigzag 2000-07-05
  • 打赏
  • 举报
回复
leslielu说的对,是少写了loop,应多注意。:)
leslielu 2000-06-27
  • 打赏
  • 举报
回复
你的do while not rstemp.eof
没有对应的LOOP!

28,390

社区成员

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

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