Empty Recordset
I have the code below that produces a list of events from the database. If the database does not contain any events, I am getting the error message below;
Error Type:
ADODB.Recordset (0x800A0BCD)
Either BOF or EOF is True, or the current record has been deleted. Requested operation requires a current record.
/addreport.asp, line 23
How can I create a message on the screen saying ‘There are no events to write reports on’?
Thanks in advance
<%
Option Explicit
Dim StrConnect
%>
<!-- #INCLUDE FILE="ProjectConnection.asp" -->
<HTML>
<HEAD>
<TITLE>Add Event Report</TITLE>
</HEAD>
<BODY>
<p align="center"><u><b><font size="7">Add an Event Report</font></b></u></p>
<BR>
<%
Dim objRS
Set objRS = Server.CreateObject("ADODB.Recordset"
objRS.Open "Events", strConnect, 3,3
objRS.MoveFirst
%>
Event Name
<FORM ACTION = "addreporttodb.asp" METHOD= "post">
<SELECT NAME="EventName" SIZE="1">
<%
Do While NOT objRS.EOF
Response.Write "<OPTION VALUE='" & objRS("Event Name"
& "'>"
Response.Write objRS("Event Name"
& "</OPTION>"
objRS.MoveNext
Loop
objRS.Close
Set objRS = Nothing
%>
</SELECT>
<P>Date<input type="text" name = "txtDate" size="20"><BR>
Report<BR>
<textarea name="txtReport" col="200" rows="12" wrap="virtual" cols="40"></textarea> <BR>
Username <input type="text" name = "txtUsername" size="20"><BR>
<INPUT TYPE="SUBMIT" VALUE="Submit"><BR>
<a href="usereventreport.asp">Event Report</a>
</form>
</body>
</html>
I have the code below that produces a list of events from the database. If the database does not contain any events, I am getting the error message below;
Error Type:
ADODB.Recordset (0x800A0BCD)
Either BOF or EOF is True, or the current record has been deleted. Requested operation requires a current record.
/addreport.asp, line 23
How can I create a message on the screen saying ‘There are no events to write reports on’?
Thanks in advance
<%
Option Explicit
Dim StrConnect
%>
<!-- #INCLUDE FILE="ProjectConnection.asp" -->
<HTML>
<HEAD>
<TITLE>Add Event Report</TITLE>
</HEAD>
<BODY>
<p align="center"><u><b><font size="7">Add an Event Report</font></b></u></p>
<BR>
<%
Dim objRS
Set objRS = Server.CreateObject("ADODB.Recordset"
objRS.Open "Events", strConnect, 3,3
objRS.MoveFirst
%>
Event Name
<FORM ACTION = "addreporttodb.asp" METHOD= "post">
<SELECT NAME="EventName" SIZE="1">
<%
Do While NOT objRS.EOF
Response.Write "<OPTION VALUE='" & objRS("Event Name"
Response.Write objRS("Event Name"
objRS.MoveNext
Loop
objRS.Close
Set objRS = Nothing
%>
</SELECT>
<P>Date<input type="text" name = "txtDate" size="20"><BR>
Report<BR>
<textarea name="txtReport" col="200" rows="12" wrap="virtual" cols="40"></textarea> <BR>
Username <input type="text" name = "txtUsername" size="20"><BR>
<INPUT TYPE="SUBMIT" VALUE="Submit"><BR>
<a href="usereventreport.asp">Event Report</a>
</form>
</body>
</html>