Solved

Microsoft VBScript runtime error '800a01a8'

Posted on 2003-11-24
6
1,287 Views
Last Modified: 2010-04-17
I keep getting this error:
Microsoft VBScript runtime error '800a01a8'
Object required: ''
 
The code was generated by Macromedia Dreamweaver, and although I know a little bit about programming I can't figure out what's wrong with it. Here is the entire page.

Additional comment: the error references line 17:
 <% While ((Repeat1__numRows <> 0) AND (NOT rs5.EOF)) %>


<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<html>
<head>
<!--#include file="Connections/guestbook.asp" -->



 </head>
 <body>
<table width="917" border="2" cellpadding="1" cellspacing="2">
  <tr>
    <td width="88">folderid</td>
    <td width="75">name</td>
    <td width="103">address</td>
    <td width="621">feedback</td>
  </tr>
  <% While ((Repeat1__numRows <> 0) AND (NOT rs5.EOF)) %>
  <tr>
    <td><%=(rs5.Fields.Item("folderid").Value)%></td>
    <td><%=(rs5.Fields.Item("name").Value)%></td>
    <td><%=(rs5.Fields.Item("address").Value)%></td>
    <td><%=(rs5.Fields.Item("feedback").Value)%></td>
  </tr>
  <%
  Repeat1__index=Repeat1__index+1
  Repeat1__numRows=Repeat1__numRows-1
  rs5.MoveNext()
      Wend
%>
</table>
<%
Dim rs5__MMColParam
rs5__MMColParam = "1"
If (Request.QueryString("sample") <> "") Then
  rs5__MMColParam = Request.QueryString("sample")
End If
%>
<%
Dim rs5
Dim rs5_numRows

Set rs5 = Server.CreateObject("ADODB.Recordset")
rs5.ActiveConnection = MM_guestbook_STRING
rs5.Source = "SELECT folderid, name, address, feedback FROM guest WHERE folderid = '" + Replace(rs5__MMColParam, "'", "''") + "' ORDER BY msgid ASC"
rs5.CursorType = 0
rs5.CursorLocation = 2
rs5.LockType = 1
rs5.Open()

rs5_numRows = 0
%>
<%
Dim Repeat1__numRows
Dim Repeat1__index

Repeat1__numRows = 10
Repeat1__index = 0
rs5_numRows = rs5_numRows + Repeat1__numRows
%>
<%
rs5.Close()
Set rs5 = Nothing
%>

</body>
</html>

Appreciate your help.
elenapie
0
Comment
Question by:elenapie
  • 3
  • 2
6 Comments
 
LVL 44

Expert Comment

by:Arthur_Wood
ID: 9812116
if the error is coming in this block:

</head>
 <body>
<table width="917" border="2" cellpadding="1" cellspacing="2">
  <tr>
    <td width="88">folderid</td>
    <td width="75">name</td>
    <td width="103">address</td>
    <td width="621">feedback</td>
  </tr>
  <% While ((Repeat1__numRows <> 0) AND (NOT rs5.EOF)) %>


the problems is that the rs Object does NOT exist at that point in the execution of the code.

Take out the "AND (NOT rs5.EOF)" and try again.

This code looks VERY VERY suspect, by the way, as the variable Repeat1__numRows is ALSO not defined at Line 17.

AW
0
 
LVL 44

Expert Comment

by:Arthur_Wood
ID: 9812119
did you manually alter this code, from what was created by DreamWeaver?

AW
0
 
LVL 7

Accepted Solution

by:
wsteegmans earned 500 total points
ID: 9812124
>> Additional comment: the error references line 17:
>> <% While ((Repeat1__numRows <> 0) AND (NOT rs5.EOF)) %>

That's exact. The error is raised because of this part: 'NOT rs5.EOF'.
This rs5 variable is your RecordSet with Databaserecords. You declare it in this code:

Set rs5 = Server.CreateObject("ADODB.Recordset")  <- Declared
rs5.ActiveConnection = MM_guestbook_STRING
rs5.Source = "SELECT folderid, name, address, feedback FROM guest WHERE folderid = '" + Replace(rs5__MMColParam, "'", "''") + "' ORDER BY msgid ASC"
rs5.CursorType = 0
rs5.CursorLocation = 2
rs5.LockType = 1
rs5.Open()        <- Opened

Unfortunately, this code is executed after your while-loop. So, we do first the loop to print all records, and then we open our recordset. That's not the right method ofcourse.
>> While ((Repeat1__numRows <> 0) AND (NOT rs5.EOF))

So, what we have to do. We must first declare our recordset (rs5), open it, and then print all the data to our HTML-Page. Change this to your code:
- Find this code-fragment:
<%
Dim rs5__MMColParam
rs5__MMColParam = "1"
If (Request.QueryString("sample") <> "") Then
  rs5__MMColParam = Request.QueryString("sample")
End If
%>
<%
Dim rs5
Dim rs5_numRows

Set rs5 = Server.CreateObject("ADODB.Recordset")
rs5.ActiveConnection = MM_guestbook_STRING
rs5.Source = "SELECT folderid, name, address, feedback FROM guest WHERE folderid = '" + Replace(rs5__MMColParam, "'", "''") + "' ORDER BY msgid ASC"
rs5.CursorType = 0
rs5.CursorLocation = 2
rs5.LockType = 1
rs5.Open()

rs5_numRows = 0
%>
<%
Dim Repeat1__numRows
Dim Repeat1__index

Repeat1__numRows = 10
Repeat1__index = 0
rs5_numRows = rs5_numRows + Repeat1__numRows
%>
- Cut it (Ctrl-X) and Paste it (Ctrl-C) just under this line:
<!--#include file="Connections/guestbook.asp" -->

Try again!
What we've done. By moving the code, our recordset is first declared and opened. So, when we do the rs5.EOF-check, there is an existing rs5 with recordset from the database.
0
Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

 
LVL 7

Expert Comment

by:wsteegmans
ID: 9812127
>> Additional comment: the error references line 17:
>> <% While ((Repeat1__numRows <> 0) AND (NOT rs5.EOF)) %>

That's exact. The error is raised because of this part: 'NOT rs5.EOF'.
This rs5 variable is your RecordSet with Databaserecords. You declare it in this code:

Set rs5 = Server.CreateObject("ADODB.Recordset")  <- Declared
rs5.ActiveConnection = MM_guestbook_STRING
rs5.Source = "SELECT folderid, name, address, feedback FROM guest WHERE folderid = '" + Replace(rs5__MMColParam, "'", "''") + "' ORDER BY msgid ASC"
rs5.CursorType = 0
rs5.CursorLocation = 2
rs5.LockType = 1
rs5.Open()        <- Opened

Unfortunately, this code is executed after your while-loop. So, we do first the loop to print all records, and then we open our recordset. That's not the right method ofcourse.
>> While ((Repeat1__numRows <> 0) AND (NOT rs5.EOF))

So, what we have to do. We must first declare our recordset (rs5), open it, and then print all the data to our HTML-Page. Change this to your code:
- Find this code-fragment:
<%
Dim rs5__MMColParam
rs5__MMColParam = "1"
If (Request.QueryString("sample") <> "") Then
  rs5__MMColParam = Request.QueryString("sample")
End If
%>
<%
Dim rs5
Dim rs5_numRows

Set rs5 = Server.CreateObject("ADODB.Recordset")
rs5.ActiveConnection = MM_guestbook_STRING
rs5.Source = "SELECT folderid, name, address, feedback FROM guest WHERE folderid = '" + Replace(rs5__MMColParam, "'", "''") + "' ORDER BY msgid ASC"
rs5.CursorType = 0
rs5.CursorLocation = 2
rs5.LockType = 1
rs5.Open()

rs5_numRows = 0
%>
<%
Dim Repeat1__numRows
Dim Repeat1__index

Repeat1__numRows = 10
Repeat1__index = 0
rs5_numRows = rs5_numRows + Repeat1__numRows
%>
- Cut it (Ctrl-X) and Paste it (Ctrl-V) just under this line:
<!--#include file="Connections/guestbook.asp" -->

Try again!
What we've done. By moving the code, our recordset is first declared and opened. So, when we do the rs5.EOF-check, there is an existing rs5 with recordset from the database.
0
 
LVL 7

Expert Comment

by:wsteegmans
ID: 9812146
Sorry, posted it 2 times :-(
Just take a look at the last one...
0
 

Author Comment

by:elenapie
ID: 9812159
Didn't alter it at all...will try your suggestion
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This is an explanation of a simple data model to help parse a JSON feed
A short article about problems I had with the new location API and permissions in Marshmallow
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

813 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now