Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

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

Posted on 2006-05-18
6
Medium Priority
?
1,743 Views
Last Modified: 2007-12-19
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..
0
Comment
Question by:bakergarry
  • 3
  • 3
6 Comments
 
LVL 17

Expert Comment

by:HuyBD
ID: 16706656
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
 

Author Comment

by:bakergarry
ID: 16706762
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
 
LVL 17

Expert Comment

by:HuyBD
ID: 16706845
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
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 

Author Comment

by:bakergarry
ID: 16706927
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
 
LVL 17

Accepted Solution

by:
HuyBD earned 1000 total points
ID: 16707110
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
 

Author Comment

by:bakergarry
ID: 16707384
thanks for getting me on the right path...

it is working now...

thanks..
garry..
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In the first part of this tutorial we will cover the prerequisites for installing SQL Server vNext on Linux.
Ready to get certified? Check out some courses that help you prepare for third-party exams.
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function
Viewers will learn how the fundamental information of how to create a table.
Suggested Courses

571 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question