EOF og BOF Fejl :(
Hejsa hvorfor får jeg en EOF BOF fejl når database en er tom, der har jeg da lavet en fejlmeddelse, men den ignorere denSe evt. http://www.fuglevig.dk/x-web/freeguestbook/default.asp?user=597
Kode
<%@ Language=VBScript %>
<!--#include file=\"function.asp\"-->
<%
ID = Request(\"user\")
Session(\"Book_ID\") = Request(\"user\")
If Session(\"Book_ID\") = \"\" then
Response.Write \"There is no ID in the request, please mail the webmaster for help\"
Else
Set Conn = Server.CreateObject(\"ADODB.Connection\")
Conn.Open \"DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=\" & Server.MapPath(\"../../data/dbguestbook.mdb\")
SQL = \"Select * From Books Where ID =\" & Session(\"Book_ID\")
Set RS = Conn.Execute(SQL)
If RS.BOF Then
Response.write \"Sorry, but the guestbook ID do not exist!<br><b>Go to <a href=\'http://www.quak.dk/guestbook\' target=\'_top\'>http://www.quak.dk/guestbook</a> to create your own one!\"
Else
If RS.EOF Then
Response.write \"Sorry, but the guestbook ID do not exist!<br><b>Go to <a href=\'http://www.quak.dk/guestbook\' target=\'_top\'>http://www.quak.dk/guestbook</a> to create your own one!\"
Else
%>
<html>
<head>
<title><% = RS(\"S_Name\")%>\'s guestbook</title>
</head>
<body>
<style type=\"text/css\">
<!--
A:link {text-decoration: none; color: #C32042}
A:visited {text-decoration: none; color: #32042}
A:active {text-decoration: none; color: #495281}
A:hover {text-decoration: underline; color: #495281}
BODY {font-family:Arial,Helvetica; font-size:11px; font-weight:normal; color:#000000;}
TD {font-family:Arial,Helvetica; font-size:11px;}
TABLE.q {padding:1px;}
.mainHeadline {font-size:15px; font-weight:bold; text-align:center;}
.inputSelect {background:#F5F5F5; color:#000000; font-family:Arial,Helvetica; font-size:10px;}
.inputText {background:#F5F5F5; color:#000000; font-family:Arial,Helvetica; font-size:10px; border:1; border-style:solid; border-color:#000000; padding-left:2px;}
.inputArea {background:#F5F5F5; color:#000000; font-family:Arial,Helvetica; font-size:11px; border:1; border-style:solid; border-color:#000000; width:100%; padding:2px;}
.inputButton {border:1; border-style:solid; border-color:#000000; background:#E5E5E5; color:#000000; font-size:11px; font-weight:bold; margin:5px 0px 5px 0px;}
.greenBar {background:#496772; color:#FFFFFF; font-size:11px; font-weight:bold; letter-spacing:2px; line-height:12px; height:16px;}
// -->
</style>
<center>
<font Face=\"verdana, verdana, arial, helvetica, helvetica\" Size=\"2\"><H2><% = RS(\"S_Name\")%>\'s guestbook</H2></font>
<table border=\"0\" cellpadding=\"5\" Cellspacing=\"0\" Width=\"640\" >
<tr>
<td bgColor=\"#96E1FF\">
<table cellpadding=\"0\" cellspacing=\"0\" Border=\"0\" Width=\"100%\">
<tr>
<td>
<font Face=\"verdana, arial, helvetica\" Size=\"2\"><B>Back to <a href=\"<% = RS(\"URL\")%>\" target=\"_top\"><% = RS(\"S_Name\")%></a></b></font>
</td>
<%
Dim RS
Dim sql
Dim strCount
Dim GuestBookID
Dim TotalPages
Dim TotalRecords
Dim startNumber
Dim CurrentPage
SQL = \"SELECT * FROM guest WHERE(Book_ID = \" & Session(\"Book_ID\") & \") Order by entry_date desc\"
Call OpenDataConnection
Set RS = Server.CreateObject(\"ADODB.RecordSet\")
RS.PageSize = Int(strPageSize)
RS.CacheSize = Int(strPageSize)
IF Request(\"p\") = \"\" THEN
CurrentPage = 1
ELSE
CurrentPage = Cint(Request(\"p\"))
END IF
RS.Open SQL, gbConn, adOpenKeyset , adLockOptimistic
TotalPages = RS.PageCount
TotalRecords = RS.RecordCount
\' flyt \"pageobjekt\" til den absolutte side
RS.AbsolutePage = CurrentPage
startNumber = TotalRecords - (strPagesize * (Currentpage -1))
IF RS.EOF THEN
Response.Write \"\"
END IF
IF RS.BOF THEN
Response.Write \"\"
END IF
%>
<td Align=\"center\">
<font SIZE=\"2\" FACE=\"verdana, arial, helvetica\">Total Guests: <B><%=TotalRecords%></b></font>
</td>
<td Align=\"right\">
<font SIZE=\"2\" FACE=\"verdana, arial, helvetica\"><B><a href=\"sign_guestbook.asp?user=<% =ID %>\">Sign Our Guestbook</a></b></font>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td>
<Br></font>
<%
IF RS.EOF THEN
Response.Write \"Sorry there are no records to display.\"
Else
End IF
IF RS.BOF THEN
Response.Write \"\"
Else
End If
strCount = Int(0)
Do while strCount < strPageSize And NOT RS.EOF
strcount = strcount + 1
%>
Resten af koden klippet væk
