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

newbie - Connection & server.mappath

Status
Not open for further replies.

Floodster

Technical User
Jan 28, 2005
204
Hi,
I'm building a site for someone & at the moment I'm hosting it on my local PC.
My problem is when I upload to the server it can't find the database as I have hard coded the directory. I know that somehow server.mappath can help but I'm unsure of the coding.
I have included my code below that I would like to be able to substitute.

dim objConn, objRS
set objConn=server.createobject("adodb.connection")
objConn.open "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=C:\Inetpub\
If someone could help I would really appreciate it as I'm pulling my hair out.

Cheers.
 
what is the actual location of the database?

Server.Mappath isn't going to make a difference if that path above is correct.

 
got it.

simply use Server.MapPath with the root of the mdb at the parm

e.g.
Code:
objConn.open "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & Server.MapPath("\webfooty\2006\footy.mdb")

many things to consider with mappath though. please read up on the parms and how it interps. your parm
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top