strConn Data Source= (trying to add the path root: /htdocs/db/profit.mdb)

MY global.asa file:::
<SCRIPT LANGUAGE="VBScript" RUNAT="Server">

Sub Application_OnStart()

 Dim strConn
 strConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=(local)\ profit.mdb"
 Application("strConn") = strConn

End Sub

</SCRIPT>


running an ASP file on my network solutions webpage, and the path is root: /htdocs/db/profit.mdb to my Access database, how do i tell it the data source path, when it keeps looking for C:/path ????

thanks..
garry..
bakergarryAsked:
Who is Participating?
 
HuyBDCommented:
the <%= Server.MapPath("\")%> return physical path of root, if you have any relative or virtual path, try to add specified name or Request.ServerVariables("PATH_INFO")
0
 
HuyBDCommented:
Try use Server.MapPath too get root

Datdir=cstr(Server.MapPath("..\yoursitename")+"htdocs/db/profit.mdb")
strConn ="Provider=Microsoft.Jet.OLEDB.4.0;Data Source="+Datdir+";Persist Security Info=False"
0
 
bakergarryAuthor Commented:
changed my global.asa::

<SCRIPT LANGUAGE="VBScript" RUNAT="Server">

Sub Application_OnStart()

 Dim strConn
 Datdir=cstr(Server.MapPath("..\www.suntzutrading.com")+"htdocs/db/profit.mdb")
strConn ="Provider=Microsoft.Jet.OLEDB.4.0;Data Source="+Datdir+";Persist Security Info=False"
 Application("strConn") = strConn

End Sub

</SCRIPT>


NOW recieve this error from my webape::

PROFIT
Microsoft JET Database Engine error '80004005'

'e:\0\119\14\771829\user\789867\www.suntzutrading.comhtdocs\db\profit.mdb' is not a valid path. Make sure that the path name is spelled correctly and that you are connected to the server on which the file resides.

/test-access.asp, line 12

0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

 
HuyBDCommented:
I have missing, change to yourpathname mean that is relative or virtual path
try to get and plus more path
server.mappath(Request.ServerVariables("PATH_INFO"))
0
 
bakergarryAuthor Commented:
this??

<SCRIPT LANGUAGE="VBScript" RUNAT="Server">

Sub Application_OnStart()

 Dim strConn
 Datdir=cstr(Server.MapPath(Request.ServerVariables("PATH_INFO"))+"htdocs/db/profit.mdb")
strConn ="Provider=Microsoft.Jet.OLEDB.4.0;Data Source="+Datdir+";Persist Security Info=False"
 Application("strConn") = strConn

End Sub

</SCRIPT>

i did it this way and my page works::

<SCRIPT LANGUAGE="VBScript" RUNAT="Server">

Sub Application_OnStart()

 Dim strConn
 strConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=e:\0\119\14\771829\user\789867\htdocs\db\profit.mdb"
 Application("strConn") = strConn

End Sub

</SCRIPT>

after using this .asp page to get my path::
 Here is an example if you are hosting your Domain on some random ISP and you want to know the structure of the web site without asking them.

The Mapath Method Is your ticket.

Run the following code from within the root of your site and it will clue you in to the physical path.

<p align="center"><font size="4" face="Arial"><b>
The Physical path to this virtual website is:
</b></font>

<font color="#FF0000" size="6" face="Arial">
<%= Server.MapPath("\")%>
</font></p>
0
 
bakergarryAuthor Commented:
thanks for getting me on the right path...

it is working now...

thanks..
garry..
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.