Forums

This topic is locked

Need to convert mappath path to physical path

Posted 09 Jan 2002 22:31:00
1
has voted
09 Jan 2002 22:31:00 Zain Magsi posted:
I got this app that has a connection to an access2000 file. The Connection include for the app looks like this:

<%
' Depending on file system hierarchy, the path may need modification
strSource = Request.ServerVariables("APPL_PHYSICAL_PATH" & "tpc\db\db1.mdb"

mstrConn = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & strSource & ";"

Function getData(strSql)
On Error Resume Next

' Open the database connection
Set acn = Server.CreateObject("ADODB.Connection"
acn.Open mstrConn

' If an error occurs opening the connection
' call the ADO error handler
If Err.number <> 0 Then
Set acn = Nothing
Call ErrorHandler(Err.number, Err.source, Err.descripition)
End If

Set rst = Server.CreateObject("ADODB.Recordset"

' Open the recordset using the command object
Set rst = acn.Execute(strSql)

' If any error occurs executing the query
' call the ADO error handler
If Err.number <> 0 Then
Set acn = Nothing
Set rst = Nothing
Call ErrorHandler(Err.number, Err.source, Err.descripition)
End If

' Disconnect the recordset
Set rst.ActiveConnection = Nothing

' Return the recordset
Set getData = rst

'acn.Close
'Set rst = Nothing
End Function

%>

I need to modify it to connect to the db on the new server in the following location and to a access97 file:

E:\webroots\globalservices.ericsson.se\db\db1.mdb

All other apps I have created using UD connect in the following way:

<%
' FileName="Connection_ado_conn_string.htm"
' Type="ADO"
' HTTP="true"
' Catalog=""
' Schema=""
MM_connCMDBtcm_STRING = "Driver={Microsoft Access Driver (*.mdb)};DBQ=E:\webroots\globalservices.ericsson.se\db\db1.mdb"
%>

Can you please help me with this.


Zain <b></b>

Zain Magsi

Replies

Replied 11 Jan 2002 16:44:19
11 Jan 2002 16:44:19 Stuart Chase replied:
Have you tried doing a Include file? UD normally does this automatically for me.

For example - one connection string that you know works in it's own .asp file like dconnect.asp

then in the individual asp pages
&lt;!--#include file="Connections/dconnect.asp" --&gt;

Assuming the dconnect is in it's own folder called Connections.



Edited by - schase on 11 Jan 2002 16:47:15

Reply to this topic