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

When I return to page connected to Access db, it fails to load

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
When I visit my asp page the first time, it works great. It is connected to an Access database with ADODB. When I leave the page and return, I get an error related to:

Set Con = Server.CreateObject("ADODB.Connection")
Con.Open "accessDSN"

I use the following to make sure that my recordset is emptied before I move to the next page:

RS.Close
con.Close
Set con=Nothing

I am reading through a book to try and figure it out. The only thing I have possibly done wrong is that I should use a semi-colon at the end of an SQL statement when using ACCESS, but I don't think that is causing the problem.

The place where the error occurs seems to point toward a problem reconnecting to my "AccessDSN", I think.

The code worked great always when I had it on my Personal Web Server, I have since transported it to IIS 5.0 on a W2K Server, but I also have made some code changes.

Any help or ideas would be greatly appreciated!
 
I think that when you connect to a DSN you have to specify it as
Conn.Open "DSN=AccessDSN"

or something like that (i don't use DSNs - due to performance issues). Check the FAQ here (faq333-178) for a FAQ on connecting to a database. It should answer some questions for you.

hope this helps
leo

 
I've came across this problem too

found it worked differently between Acc97 and Ac2000

Solved problem in 2000 by using this code:

Set conn=Server.CreateObject("ADODB.Connection")
conn.Open "AccessDSNName"


ie removing the "DSN=" from the second line.

I don't know why this worked, but it seemed to - any opinions??

Andy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top