# How To Get Absolute Path In Javascript



## mhadi (Aug 9, 2004)

Hi All,
I am developing a solutions for clients to run some webpages. Since there is no webserver the ASP route is a No Go. So I am using Javascript to connect to my database.

The Problem is that the following Connection string
var conn_str = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=Data.mdb";
Search of Data.mdb on the desktop.

I came to know that this requires absolute path i.e
var conn_str = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Folder1\Data.mdb";

But the problem is the web pages will be distributed on CD and drive name may differs. Further more if the user copies the pages to the hard disk it may stop working. 

I want to know how can I get the absolute path, in ASP we use Server.MapPath but what function to use in javascript only version?

Thanks in advance
mhadi


----------



## Arkur55 (Dec 26, 2005)

I have not tried this on a cd, but it might work

Dim sDataSource
Dim objCon

Sub subConnectionOpen
Set objCon = CreateObject("ADODB.Connection")
Set objRS = CreateObject("ADODB.Recordset")
sProviderName = "Microsoft.Jet.OLEDB.4.0"
iCursorType = 1
iLockType = 3
sDataSource = InputBox ("Enter path to DB file Exp: C:\Data\dbCompInfo.mdb") 
objCon.Provider = sProviderName
objCon.Properties("Data Source") = sDataSource
objCon.Open
End Sub


----------



## mhadi (Aug 9, 2004)

Thanks Alot but I am dealing with such client whose end users cannot even read simple instructions and modify the security settings of the internet explorer. The question is how to get the absolute path Automatically!!


----------

