这是我的guestbook.asp程序源代码:
出错显示为空白页面
<!--include file="adofunction.asp"-->
<%
sub showpage(objrs,pageno)
redim fig(objrs.pagesize-1),bg(objrs.pagesize-1)
randomize
for i=0 to objrs.pagesize-1
fig(I) =int(rnd*9)+1&".gif"
next
bg(0)="#d9d9ff"
bg(1)="#ffcaee"
bg(2)="#ffffcc"
bg(3)="b9eeb9"
bg(4)="#b9e9ff"
response.write "<table align='center' width='90%'>"
objrs.absolutepage=pageno
for i=1 to objrs.pagesize
response.write "<tr bgcolor= " & bg(i-1) & ">"
response.write "<td width='85%'>作者:"&objrs("作者")&"<BR>主题:"&objrs("主题")& "<BR>时间:" & objrs("时间")&"<HR>内容:"&objrs("内容")&"</td></tr>"
objrs.movenext
if objrs.eof then exit for
next
response.write"</table>"
end sub
%>
<html>
<body>
<%
strsql="select * from liuyanban order by Time desc"
set objrs=getsqlrecordset(strsql,"books.mdb","liuyanban")
objrs.pagesize=5
pageno=request("pageno")
response.write"["
for i=1 to objrs.pagecount
if i=cint(pageno) then
response.write i & " | "
else
response.write"<a href='guestbook.asp?pageno=" & i &"'>" &_
i & "</a>" & " | "
end if
next
response.write"]<HR>"
%>
<%
if pageno<>"" then
showpage objrs.pageno
else
showpage objrs,1
end if
objrs.close
set objrs=nothing
objconn.close
set objconn=nothing
%>
<hr>
<!-显示输入新留言表单-->
<form method="post" action="post.asp">
<table border="0" width="90%"align="center" cellspacing="0">
<tr height="40" bgcolor="#0084ca"align="center" valign="middle">
<td colspan="2"><font color="#ffffff">请在此输入新的留言</font></td>
</tr>
<tr height="40" bgcolor="#d9f2ff" align="center" valign="middle">
<td width="15%">作者</td>
<td width="85%"><input type="text" name="Author" size="50"></td>
</tr>
<tr height="40" bgcolor="#84d7ff" align="center" valign="middle">
<td width="15%">主题</td>
<td width="85%"><input type="text" name="Theme" size="50"></td>
</tr>
<tr height="250" bgcolor="#d9f2ff" align="center" valign="middle">
<td width="15%">内容</td>
<td width="85%"><textarea name="Content" cols="48" rows
="10"></textarea></td>
</tr>
<tr>
<td colspan="2" height="40" bgcolor="#ffffff" align="center">
<input type="submit" value="张贴留言">
<input type="reset" value="重新输入"></td>
</tr>
</table>
</form>
</body>
</html>
adofunction.asp源代码:
function getsqlrecordset(strsql,Books.mdb,liuyanban)
set objconn=server.createobject("adodb.connection")
objconn.connectionstring="provider=microsoft.jet.oledb.4.0;"& _
"data source="& server.mappath(Books.mdb)
objconn.open
set getsqlrecordset=server.createobject("adodb.recordset")
getsqlrecordset.open strsql,objconn,adopenkeyset,adlockoptimistic,
adcmdtext
end function
function getsecurerecordset(Books.mdb,liuyanban)
set objconn=server.createobject("adodb.connection")
objconn.connectionstring="provider=microsoft.jet.oledb.4.0;"& _
"data source="& server.mappath(Books.mdb)
objconn.open
set getsecurerecordset=server.createobject("adodb.recordset")
getsecurerecordset.open liuyanban,objconn,adopenkeyset,
adlockoptimistic,adcmdtable
end function
post.asp代码如下:
<!--#include file="adofunction.asp"-->
<%
dim author,theme,content,currenttime
author=request("Author")
theme=request("Theme")
content=request("Content")
currenttime=Now()
set objrs=getrecordset("Books.mdb","liuyanban")
objrs.addnew
objrs("Author")=author
objrs("Theme")=theme
objrs("Content")=content
objrs("CurrentTime")=now()
objrs.update
objrs.close
set objrs=nothing
objconn.close
set objconn=nothing
response.redirect"guestbook.asp"
%>