Forum Moderators: open

Message Too Old, No Replies

External Database Connection

         

ukgimp

3:13 pm on Aug 8, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hello

I have a database connection and subsequent script that works fine when it is all in one page. I get 500 errors when trying to take the connection to an external file. This is baffling me.

Connection file:
Dim conn
Set conn = Server.CreateObject("ADODB.Connection")
conn.Open("DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("\thedb.mdb"))
response.write("working")

Page Requiring Connection
<!--#include file="thedb/dbconn.asp" -->

Any ideas, I did this years ago with MM, but it just did it for you.

mattur

3:23 pm on Aug 8, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The data connection string looks fine, could it be the way you are including the connection file?

Page Requiring Connection
<!--#include file="thedb/dbconn.asp" -->

This uses relative addressing so it looks for the connection file in a subdir of the current folder called "thedb". Should this instead be an absolute url (i.e. thedb is a root folder)? If so, try:

<!--#include virtual="/thedb/dbconn.asp" -->

HTH

macrost

8:24 pm on Aug 8, 2003 (gmt 0)

10+ Year Member



Just to make sure... you aren't trying to use the include within a script block? i.e.
<%
code here
<!--#include file="thedb/dbconn.asp" -->
%>
This won't work... Includes are outside of script blocks. Just taking a stab in the dark.
Mac
;)

ukgimp

10:26 pm on Aug 8, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Thanks both.

Macrost, that look it is could be it. I an not abale to check at the moment, but I do have it setp up like you suggest it should not be.

cheers