Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Object Require: " ????? 4

Status
Not open for further replies.

PhatH

IS-IT--Management
Mar 30, 2004
88
US
Hello all,

I got a very frustrating ERROR:

Microsoft VBScript runtime (0x800A01A8)
Object required: ''
/includes/subnav/labelsribbons_subnav.asp, line 4

This is my code:

<% If request.querystring("Labels") <> "" Then
sql = "SELECT * FROM tblRibbons"
Set rs = objConn.Execute(sql)
End If
%>
<div id="subnavlist">
<ul>
<li><A href="/products/hardware/lablesribbons/default.asp?Product=3&Labels=0">Labels</A></li>
<li><A href="/products/hardware/lablesribbons/default.asp?Product=3&Labels=1">Ribbons</A></li>
<% If request.querystring("Labels") = "1" then %>
<FORM>
<SELECT NAME="ribbons">
<%
do while not rs.eof
%>
<OPTION VALUE="<% =rs("RibbonID") %>"><% =rs("RibbonName") %></OPTION>
<%
rs.movenext
loop
%>
</SELECT>
</FORM>
<% End if %>
<li><A href="/products/hardware/lablesribbons/default.asp?Product=3&Labels=2">Get A Quote</A></li>
/ul>
</div>
 
How are you declaring the connection object? Try adding this:

<%
dim objConn

set objConn = Server.Createobject("ADODB.Connection")

let me know if this helped.

Cassidy

 
This is my database connection file

Set objConn = Server.CreateObject("ADODB.Connection")
objConn.Open "Driver={SQL Server};" &_
"Server=***;" &_
"Database=****;" &_
"Network=DBMSSOCN;" &_
"Uid=***;" &_
"Pwd=***;
 
What happens if your IF condition fails, then it does not have a recordset rs object set.

And still you are performing the other part of the code using rs.

So that might be the error.

VJ
 
That looks ok. I take it your using an include statement or have this in your global.asa?

 
what about the rs?

if you do not create the recordset object as in
Server.CreateObject("ADODB.recordset")
and use the Set = .Execute method and you have Option Explicit in the page, then it may create this error.



___________________________________________________________________

The answer to your ??'s may be closer then you think. faq333-3811
Join the Northern Illinois/Southern Wisconsin members in Forum1064
 
Also try this in your conditions:

If trim(request.querystring("Labels"))

-VJ
 
I don't know...

I seemed to check everything... rs, if.. else, etc.

This file even a copy of another file that works fine in a different page.

Hmmmm!!!!!!!!!!

I got to back track my steps.

Thank you everyone... If you find anything new, please let me know. I'll check back a moment later. Thanks again! :)
 
It seems to me that the problem is occured right at the beginning of the page as soon as I click to a link to that page.

And if I change the code a little bit on the top to specify the condition that only if Labels = 1 is selected:

<%
if request.querystring("Labels") = "1" then
sql = "SELECT * FROM tblRibbons"
Set rs = objConn.Execute(sql)
end if
...
Only then the specific link "Labels 1" got the ERROR while the other links on the same page work ok!

Any suggestion??? :)
 
Update...

I remove every ASP code in the table, only leave:

<%
sql = "SELECT * FROM tblRibbons"
Set rs = objConn.Execute(sql)
%>
<div id="subnavlist">
<ul>
<li><A href="/products/hardware/lablesribbons/default.asp?Product=3&Labels=0">Labels</A></li>
<li><A href="/products/hardware/lablesribbons/default.asp?Product=3&Labels=1">Ribbons</A></li>
<li><A href="/products/hardware/lablesribbons/default.asp?Product=3&Labels=2">Get A Quote</A></li>
</ul>
</div>

The ERROR is still there, and only work again after I remove the rest of the ASP code on top.

???
 
Did you mean this also created errors:

<%

set objConn= Server.CreateObject("ADODB.Connection")
set rs= Server.CreateObject("ADODB.recordset")


sql = "SELECT * FROM tblRibbons"
Set rs = objConn.Execute(sql)
%>
<div id="subnavlist">
<ul>
<li><A href="/products/hardware/lablesribbons/default.asp?Product=3&Labels=0">Labels</A></li>
<li><A href="/products/hardware/lablesribbons/default.asp?Product=3&Labels=1">Ribbons</A></li>
<li><A href="/products/hardware/lablesribbons/default.asp?Product=3&Labels=2">Get A Quote</A></li>
</ul>
</div>
 
The table name was rechecked.

I pasted the added lines of Amorous, and the ERROR is still there.

I narrow down to this line when the ERROR happens

Set rs = objConn.Execute(sql)

When I remove this line, the page open again. Paste it back, ERROR re-appears.
 
sorry...try it instead of the excute

should be like this

rs.open SQL, objConn,1,3
 
To amorous,

The new ERROR has happened when I use your added lines:

ADODB.Connection (0x800A0E78)
Operation is not allowed when the object is closed.
/includes/subnav/labelsribbons_subnav.asp, line 6


 
try this then:

<%

set objConn= Server.CreateObject("ADODB.Connection")
set rs= Server.CreateObject("ADODB.recordset")

sql = "SELECT * FROM tblRibbons"
rs.Open sql, objConn
%>

VJ
 
The error is still there with a new rs.open code, sorry!!!
<%
sql = "SELECT * FROM tblRibbons"
rs.open sql, objConn,1,3
%>
<div id="subnavlist">
<ul>
<li><A href="/products/hardware/lablesribbons/default.asp?Product=3&Labels=0">Labels</A></li>
<li><A href="/products/hardware/lablesribbons/default.asp?Product=3&Labels=1">Ribbons</A></li>
<li><A href="/products/hardware/lablesribbons/default.asp?Product=3&Labels=2">Get A Quote</A></li>
</ul>
</div>
 
Sorry amorous,

ERROR:

Error Type:
ADODB.Recordset (0x800A0E7D)
The connection cannot be used to perform this operation. It is either closed or invalid in this context.
/includes/subnav/labelsribbons_subnav.asp, line 7
 
hmm.. i hope you made connections to your database.

something like this:

<%

set objConn= Server.CreateObject("ADODB.Connection")
set rs= Server.CreateObject("ADODB.recordset")
objConn.Open StringConnect <--- where StringConnect is your connection string
sql = "SELECT * FROM tblRibbons"
rs.Open sql, objConn
%>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top