新手求教:有一个access在IIS下的数据读取,反复调试总是出问题。
修改模版修改出来的,在IIS服务器上运行。存储过程测试没有问题,但是显示出了大问题!以下是代码,目的是为了把data文件夹下名叫baogao.mdb的access数据库的repairAthrow表的文件调出来并分页显示在网页上。但调试很多遍总是出问题,调试时最常出现的问题是少";",但是原来没有修改的模版也能正常运行。技术水平太低查到这里查不下去了大神帮忙检阅一下
【r_dtableview.jsp】
<%@ LANGUAGE="javascript" %>
<!--#include file="conn.asp"-->
<!--#include file="viewbac.asp"-->
<html>
<head>
<title>分页显示表记录</title>
<style type="text/css">
<!--
.style1 {font-size: 14px}
.style2 {font-family: "黑体";font-size: 16px;color: #8B1A1A;}
-->
</style>
</head>
<body >
<h2 align="center"> </h2>
<h2 align="center" class="style2">分页显示学生档案表</h2>
<span class="style1">
<%
dim mysql;
on error resume next;
set mysql=server.createobject("ADODB.CONNECTION");
mysql.open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & DefaultDir &server.mappath("data/baogao.mdb")&";";
mysql="select * from repairAthrow;
set zd=server.CreateObject("ADODB.Recordset");
zd.Open (sql,star,3);
zd.pagesize=3;
if (0==Request("page").Count) {Page=1;}
else {Page=parseInt(Request("Page"))}
if (Page<1) {Page=1;}
if (Page>zd.PageCount) {Page=zd.PageCount;}
ShowOnePage(zd,Page);
Response.Write(" ");
Response.Write("<div align=center>");
if (!(1==Page))
{
Response.Write("<A HREF=6-14.asp?Page=1>首页</A>");
Response.Write("≡");
Response.Write("<A HREF=6-14.asp?Page="+(Page-1)+">上一页</A>");
Response.Write("≡");
}
if (!(zd.PageCount==Page))
{Response.Write("<A HREF=6-14.asp?Page="+(Page+1)+">下一页</A>");
Response.Write("≡");
Response.Write("<A HREF=6-14.asp?Page="+zd.PageCount+">末页</A>");
Response.Write("≡");}%>
</p>
</span>
<p class="style1">页数:
<font color="blue">
<%=Page%>/<%=zd.PageCount%></font></p>
<p align="center" class="style1"> </p>
</div></body>
</html>
【viewback.jsp】
<%
function ShowOnePage( zd, page )
{
Response.Write("<center><table border=1 bordercolor=blue>");
Response.Write("<tr bgcolor=gray>");
Response.Write("<td><font size=2 color=white><b>ID</b></font></td>");
var i;
for (i=0; i<zd.Fields.Count; i++)
{
Response.Write("<td><font color=white size=2><b>" + zd.Fields(i).Name + "</b></font></td>");
}
Response.Write("</tr>");
zd.AbsolutePage = page;
var ipage;
for (ipage=1; ipage<=zd.pagesize; ipage++)
{
if (!zd.EOF)
{
Response.Write("<tr align=middle>");
RecNo = (page - 1) * zd.pagesize + ipage;
Response.Write("<td>" + RecNo + "</td>");
for(i=0; i<zd.Fields.Count; i++)
{
Response.Write("<td>" + zd.Fields(i).Value + "</td>");
}
Response.Write("</tr>");
zd.MoveNext();
}
}
Response.Write("</table></center>");
}
%>
【conn.asp】
<%
dim conn
dim connstr
on error resume next
set conn=server.createobject("ADODB.CONNECTION")
conn.open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & DefaultDir &server.mappath("data/baogao.mdb")&";"
%>