Copy link to clipboard
Copied
Hi all,
I am having some troubles using the dsn connection I have made and tested successfully in DW. I followed the guidance to create a dsn but I have created an include file to make this connection for the pages in use. However I get an error message '80004005' when I go to make the connection using the include file.
Include file
<%
Set conn=Server.CreateObject("ADODB.Connection")
conn.Open "dsn=dsnConn;"
Sub closeconn()
conn.Close
Set conn=Nothing
End Sub
%>
in another asp page I call this include file and want to use the connection to access the database table
SQL="SELECT * FROM Authors"
Set SQLIO = conn.Execute(SQL)
......
As I said earlier, the dsn is set up and is the test works. I tried doing a similar thing with the .asp file created by DW when I made the dsn connection but am unsure how I can reference and use this is the same way as I could as the variable conn in the include file as this only provides the dsn string. Below is the contents of the file created by DW on connection of the dsn.
<%
' Filename="Connection_odbc_conn_dsn.htm"
' Type="ADO"
' DesigntimeType="ADO"
' HTTP="false"
' Catalog=""
' Schema=""
Dim dsnConn_STRING
MM dsnConn_STRING = "dsn=dsnSQL;"
%>
Any help or if you require additional information it would be greatly appreciated.
Copy link to clipboard
Copied
Your DSN's in the two examples you provided are not the same: dsnConn vs dsnSQL.
I'm not sure why you want to create your own include file rather than just using the DW connection file. I would also advise against opening the connection in the include file. Just use it to store the connection string.
Copy link to clipboard
Copied
Thanks for the update. You know when you look at something long enough you miss the obvious. Just one more
thing. How would I store the connection string in the include file?
Copy link to clipboard
Copied
>How would I store the connection string in the include file?
DW does this for you when you create a connection. The connection file it creates IS an include file.