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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

object required

Status
Not open for further replies.

Bamarama

Programmer
Dec 29, 2006
49
US
SO I am using the same ASP coding I have always used, and I am now running into an unknown error. The error is as follows:
Code:
Microsoft VBScript runtime error '800a01a8'

Object required

/personal_stats.asp, line 153
line 153 is
Code:
set stats1 = conn.execute("select count(id) as cnt1 from _scores where id = "&userid2&"")

the ID field is a number. I am trying to cound the number of times a user has made an entry. I have done this numerous times before but now I am getting this error.
here is the connection info for SQL db
Code:
<%

Set Conn = Server.CreateObject("ADODB.Connection")
	Conn.Open = "Provider=sqloledb; Data Source=dbs5.myhost.com ; Initial Catalog=dbname; User Id=myusername; Password=mypassword; Connect Timeout=60"
%>
then of course i have the include
Code:
<!--#include file="connection.asp"-->
at the top of the page. Any ideas here?
 
Hi,
I do not remember if VBScript is case-sensitive regarding Object names, but if it is then , then

set stats1 = conn.execute("select count(id) as cnt1 from _scores where id = "&userid2&"")

does not match

Set Conn = Server.CreateObject("ADODB.Connection")


[profile]

To Paraphrase:"The Help you get is proportional to the Help you give.."
 
TEST the SQL statement manually to make sure it IS returning records.

Chris.

Indifference will be the downfall of mankind, but who cares?
Time flies like an arrow, however, fruit flies like a banana.
 
Not sure what you mean by testing manually. I replaced conn.execute with response write and got this:

Code:
select count(id) as cnt1 from _scores where user_id = 1
where 1 is the correct id being passed
i changed the line to user_id from id since the user id is different than the id.

all characters are lower case. I have been using this type of connection to the db, as well as the way i retrieve information for years. It is only recently when this has started happening.

if you need any other info to help me solve this, please let me know.
 
Testing manually:


Take the displayed query and use it in whatever tool you use to manage the database

Chris.

Indifference will be the downfall of mankind, but who cares?
Time flies like an arrow, however, fruit flies like a banana.
 
ok. so now, ANY new code gives me this error.

ANY time I do a Set whatever = conn.execute("select....

i get this same error. Could this be some IIS setting gone wrong or something? the codes work fine within the DB when tested, it is just when I am writing new code. ALL of the old code using this method works fine. It is just new code. Doesn't make any dang sense. Any ideas??


seriously, I can't do squat until I fix this..... :(
 
[tt]> [/tt]Conn.Open = "Provider=sqloledb; Data Source=dbs5.myhost.com ;..."
Never heard connection object had an open property, it has an open method all right!
[tt] Conn.Open[highlight] [/highlight]"Provider=sqloledb; Data Source=dbs5.myhost.com ;..."[/tt]
 
Good catch :)

Chris.

Indifference will be the downfall of mankind, but who cares?
Time flies like an arrow, however, fruit flies like a banana.
 
changed

Conn.Open = "Provider=sqloledb;

to

Conn.Open "Provider=sqloledb

getting same error :(
 
You know, I appreciate all the help here. And thanks for trying.....

and ummm..... i feel like such an idiot now.



I figured it out. I almost want to just not say how and leave and stuff but I can't.

It is a HUGE help when you actually include the connection string on the page you wish to use the connection on
<!--#include file="connection.asp"--> is a big help.


******* feeling like an idiot now ******
 
I don't what the op's trying to say and what has impacted their way of thinking, such as include... But you know, the same error does mean a thing as to what to code or what not. It is not a trial and error. Why not say it is a typo or something?
 
well, because I am an honest person, I had to be honest.

Second, if someone searches for the same error, this lets them know exactly what happened, and might have them look for a simple solution, and not complex like I was looking for.
 
I have some typo in my messge, but you probably have got the meaning right, though. But, are you trying to say with an equal sign, it works?! Is that what you mean by honest?
 
yes, it works with or without the =

the issue was, I didn't actually tell the page to open the db. I always do this by having a connection page with the string. then use
Code:
<!--#include file="connection.asp"-->
on the pages that need the DB to open, then use
Code:
<%
Conn.Close
Set Conn = Nothing
%>
to close it.

So I failed to actually open the DB, therefore, there was no object, and that was causing the errors.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top