Forum Moderators: open

Message Too Old, No Replies

ASP page brings up

         

bmouthrob

11:02 am on Jun 27, 2006 (gmt 0)

10+ Year Member



For example if you go to my site directly to an event's page :

You will receive the following error message:

ADODB.Recordset error '800a0e7d'

The connection cannot be used to perform this operation. It is either closed or invalid in this context.

/old_event_details.inc, line 37

However, if you then do a refresh, or alternatively access the page via the front page etc this problem doesn't occur!?

Does anyone have any similar experiences? I am using a Jet 4 connection...

Thanks in advance!

[edited by: txbakers at 2:30 am (utc) on June 28, 2006]
[edit reason] no personal URL's please [/edit]

bmouthrob

11:46 am on Jun 27, 2006 (gmt 0)

10+ Year Member



Oh and I am thinking of converting to MYSQL soon, but I really need a temp fix, as it means that google is not indexing any of my pages! ='o(

Thanks again.

mattur

12:08 pm on Jun 27, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The message suggests you're trying to do something to a database when there isn't a database connection open to use:

eg:
- open connection
- do stuff on db
- close connection
- try to do some more db stuff: error occurs

or just:
- (with no connection) try to do some db stuff: error occurs

So, what changes? What is handled differently on the 2nd request compared to the 1st request? Are you using session variables to hold connection objects (not recommended) or control processing flow?

You can put in simple response.writes to debug your code, e.g. where the db connection is opened just response.write "connection opened", "open recordset", "connection closed" etc. You may need to put in an "On error resume next" to ensure you can see these debug msgs. HTH.

bmouthrob

3:21 pm on Jun 27, 2006 (gmt 0)

10+ Year Member



Hi,

Thats the weird thing; I am opening the connection, performing the operations and then closing the connection. The connection is stored in a local variable (which is opened in an include file).

The only thing i can think is that the page is an asp page, and the code which is run within the page is determined on the date (to show whether the event is an old event or an event in the future...) which is pulled in from an include file. The DB connection happens in another include file further up the page.
As far as I understand though this should have no baring whatsoever as the include files should be brought in before any code is run.
Also the way it is happening suggests that something is happening at the end of the page loading which is then staying open for when the page is refreshed? But as it is local variables being used how could this be happening?!

This is really bugging me now!

bmouthrob

2:44 pm on Jun 28, 2006 (gmt 0)

10+ Year Member



Found the problem!

It was that when any page loads for the first time, there is a cookie check that I had forgotten about. The cookie check opened a connection to the database though and subsequently closed it! This was nestled within 3 layers of include files though!

Oh well sorted now. Roll on being re-indexed!