Please help VBSCRIPT EXCEPTION ???

They have: 82 posts

Joined: Oct 2001

I am getting the following error when I try to do a RS.OPEN.

Microsoft VBScript runtime (0x800A01FB)
An exception occurred: 'Open'

I have been to the Microsoft site, and they say it is an issue with trying to store the recordset in a session variable. Their suggestion was to use MDAC 2.6. I upgraded and still receive the same error.
This started happening after I installed service pack 2 for win2k.

Any ideas?

Thanks,

- Mike

Blessed is the man who fears the LORD, who delights greatly in his commandments. Psalms 112:1

Mark Hensler's picture

He has: 4,048 posts

Joined: Aug 2000

Welcome you to TWF. I like your sig!

Your storing a recordset in a session var? I never knew you could do that. I'm sorry I don't have an answer to your problem.

Mark Hensler
If there is no answer on Google, then there is no question.

They have: 82 posts

Joined: Oct 2001

Mark,

Thanks for your reply. You may have helped me more than you know. How would you loop through a recordset if you do not store it in a session variable?

I became a member around January. I have received a lot of valuable info from this forum and I love it! I have told all my friends as well. I have been doing VB development for about the past six months. When I came back I forgot my username and password, so I had to get a new one. I am sure that makes the database admin happy!

By the way the sig works! and thanks for the reply.

- Mike

Blessed is the man who fears the LORD, who delights greatly in his commandments. Psalms 112:1

Peter J. Boettcher's picture

They have: 812 posts

Joined: Feb 2000

Hey Mike, how's it going?

First off you should avoid storing ADO recordsets in a session, especially if it's a large one. Are you trying to pass the recordset between pages?

Maybe if you could post the source code we could help you better.

PJ | Are we there yet?
pjboettcher.com

They have: 82 posts

Joined: Oct 2001

OK how do I get a cool avatar? I do not have any available.

I am doing great!!! and you?

Here is a snippet. I removed the stuff that did not have to do with the data access. This is the first time I have had this problem. I am working with pre-existing code. It may be best for me to just start over on the data access portion.

Any ideas?

Thanks,

- Mike

CN="driver={microsoft access driver (*.mdb)};"
CN=CN & "dbq=" & server.mappath(accessdb)
set RecordSet = server.createobject("ADODB.Recordset")
SQL = "select max(value.value)"
RecordSet.Open SQL, CN, adOpenStatic

if RecordSet.eof or RecordSet.bof then
response.write " No results found..."

end if
%>

'''' I HAVE TAKEN THE HTML OUT HERE

<?php
'Write the field names
for each table_element in RecordSet.fields

''''''   DO YOUR STUFF


RSCurrentBid.movefirst
do while not RecordSet.eof
for each cell in RecordSet.fields

?>

' DO MORE STUFF LOOP ETC.

Blessed is the man who fears the LORD, who delights greatly in his commandments. Psalms 112:1

Peter J. Boettcher's picture

They have: 812 posts

Joined: Feb 2000

The first thing that I noticed was this line:

CN=ConnCurrentBid & "dbq=" & server.mappath(accessdb)

What is ConnCurrentBid?, shouldn't this line read:

CN = CN & "dbq=" & server.mappath(accessdb)

Also, you seem to be looping through the recordset more than once, you should try to limit this. If you have to then maybe you should look into using the GetRows method, this will improve performance since you can close your recordset early and use the data through arrays.

PJ | Are we there yet?
pjboettcher.com

They have: 82 posts

Joined: Oct 2001

Peter,

I changed some of the code (variable names) to make it easier to read. I did miss that one. CN was ConnCurrentbid, and they were all the same.

You are correct there are two for each loops in this code. I may just start over and make this code a little neater.

Thanks,

Mike

Blessed is the man who fears the LORD, who delights greatly in his commandments. Psalms 112:1

Peter J. Boettcher's picture

They have: 812 posts

Joined: Feb 2000

I figured that might be a typo...

The only other thing I can suggest would be to experiment with different cursortypes,locktypes, and location types. Maybe specifiy adUseClient?

You should probably rewrite that if it wasn't your code to start with, ADO is so much fun anyways, it's not like work! (and if you believe that....)

PJ | Are we there yet?
pjboettcher.com

They have: 82 posts

Joined: Oct 2001

OK
Here is the deal. I feel like a moron for not recognizing what was going on.

The problem is in this line:

SQL = "select max(value.value)"

If I remove the max() function everything works fine.

When this error occured no other .ASP pages could perform a
Recordset.Open until I shut the machine down. Then I could run those pages until I ran this one again.

I would get that nasty error.

Blessed is the man who fears the LORD, who delights greatly in his commandments. Psalms 112:1

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.