Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Building a connection string with ASP

Status
Not open for further replies.

rry2k

Programmer
Jun 28, 2001
678
US
The company that hosts our website recently switched us from Unix to NT per our request. I have some forms on our site that used CGI to send results to email. I now need to send the results to a database. The examples in the books I have discuss building connections strings using a path like C:\whatever..(a virtual directory on my server). My problem is we don't host our own website. Question: How do I set up the path under these circumstances. Maybe a url?

Thanks in advance for the help.
Russ
 
This probably belongs over in the ASP forum, but...

you can use server.mappath() to map out the absolute path to your database from a relative path...

Like say you have your script that is sitting in the same directory as your database, then you would ask for:

<%
dim path
path = server.mappath(&quot;theDBName.mdb&quot;)
%>

path will now hold a string something to the effect of:

&quot;d:\usrs\accountName\rootWeb\dir\theDBName.mdb&quot;

or whatever that actual disk path is.

and you can insert the server.mappath() right in your connection string.

good luck! :)
Paul Prewett
penny.gif
penny.gif
 
Here is an example:

<%
Set objconexao = Server.CreateObject(&quot;ADODB.connection&quot;)
dir = server.mappath(&quot;../dados/nferraz.mdb&quot;)
objconexao.open &quot;dbq=&quot;&dir&&quot;;DRIVER={Microsoft Access Driver (*.mdb)}&quot;
%>

Frederico
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top