程序错在哪里?
以下是用子过程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
%>