|
 |
asp_databases thread: Connecting Access database regardless of Database path
Message #1 by "Khalid Qureshi" <khalidone@y...> on Tue, 25 Feb 2003 19:09:28
|
|
Hi every body,
I want to want to make the connection to access database in such a way
that the connection string should be independant of the database path like
we make independant connection string in Visual basic using "App.path" we
can access the database in the same folder where our project is saved
regardless of the drive and folder name. If any one have solution please
tell me. That will be a great help for me.
Khalid
Message #2 by "Peter Foti (PeterF)" <PeterF@S...> on Tue, 25 Feb 2003 14:19:56 -0500
|
|
Sounds like you are referring to Server.MapPath. For example, using an
Access database in the same folder, you could do something like this:
<%
Dim DBName
Dim DBPath
Dim ConnStr
Dim DBConn
DBName = "myaccessdb.mdb"
DBPath = Server.MapPath(DBName)
ConnStr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & DBPath & ";"
Set DBConn = Server.CreateObject("ADODB.Connection")
DBConn.Open ConnStr
%>
Regards,
Peter Foti
> -----Original Message-----
> From: Khalid Qureshi [mailto:khalidone@y...]
> Sent: Tuesday, February 25, 2003 7:09 PM
> To: ASP Databases
> Subject: [asp_databases] Connecting Access database regardless of
> Database path
>
>
> Hi every body,
> I want to want to make the connection to access database in
> such a way
> that the connection string should be independant of the
> database path like
> we make independant connection string in Visual basic using
> "App.path" we
> can access the database in the same folder where our project is saved
> regardless of the drive and folder name. If any one have
> solution please
> tell me. That will be a great help for me.
>
> Khalid
>
|
|
 |