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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

needing a script for a non-dns server

Status
Not open for further replies.

evlhomer01

Technical User
Jan 23, 2002
3
GB
hello, i have been told by my hosts that if i want to connect my access database to my UD4 pages i need a .asp script. i have no idea what i need in that, could someone tell me what to put in it!
 
dim strCon,path
path = server.MapPath("myDB.mdb")
strCon = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & path & ";Persist Security Info=False"


server.mapPath is the key there... put the relative path to your database in there, and the method will return the absolute path to it, which is what the connection string must contain.

Then, when you open your connection, use this syntax:

connection.open strCon

:)
paul
penny.gif
penny.gif
 
This is the code that I use to connect to a Microsoft Access data base- This code is in a file called Jeff.asp in the "Comnnections" folder

<%
' FileName=&quot;Connection_ado_conn_string.htm&quot;
' Type=&quot;ADO&quot;
' HTTP=&quot;true&quot;
' Catalog=&quot;&quot;
' Schema=&quot;&quot;
MM_Jeff_STRING = &quot;Driver={Microsoft Access Driver (*.mdb)}; DBQ=d:\web sites\learning\Tom_Test\Jeff\FET.mdb&quot;
%>
 
Another helpful hint. Drop me a note and I can forward a file that you can run on your server that will tell you the drive, path etc so the previous post's suggestion will help. I personally steer towards the mappath as the lovely people at your hosting company may move your virtal directory onto another box and not tell you! (hmm....does it sound like that happened to me!?)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top