Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

File names

Posted on 2004-08-12
3
Medium Priority
?
161 Views
Last Modified: 2010-04-07
sorry, heres another noob question:
and i apologize if i use incorrect terminology.

on my local server ive been using a specific path name to reference my database location (i.e: C:\aspnet\database.mdb)
when i upload my website to the host how would i reference the database if it is in the same directory as the aspx file? i keep getting errors when i try to use like: /database.mdb or \database.mdb or just database.mdb
does it have something to do with server.MapPath ?? thanks a lot

     'set connection
      dim objConn as new OleDbConnection _
      ("Provider=Microsoft.Jet.OLEDB.4.0;" & _
      "Data Source= what goes here?? ")
0
Comment
Question by:danimbrogno
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 10

Expert Comment

by:Clif
ID: 11785530
If it is in the same folder as the aspx, then reference it directly (no slashes needed):

 'set connection
      dim objConn as new OleDbConnection _
      ("Provider=Microsoft.Jet.OLEDB.4.0;" & _
      "Data Source= myDatabase.mdb ")

Similarly, if it is in a subfolder of the current webfolder, you can reference it starting from the current aspx folder using backslashes *except* no backslash at the beginning:

 'set connection
      dim objConn as new OleDbConnection _
      ("Provider=Microsoft.Jet.OLEDB.4.0;" & _
      "Data Source= databases\myDayabase.mdb ")

It's when it's outside of your current web folder tree that you get in trouble.
0
 

Author Comment

by:danimbrogno
ID: 11786001
for some reason that doesnt work... but ive solved the problem, i ended up using this code

("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & server.mappath("products.mdb"))

Ill give the points if someone knows why i needed the server.mappath deal... it stumps me
0
 
LVL 96

Accepted Solution

by:
Bob Learned earned 750 total points
ID: 12070909
Using Server.MapPath
http://www.4guysfromrolla.com/webtech/121799-1.shtml

"Each file on a Web server has two ways of being accessed - through a virtual path and through a physical path..."

Bob
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

This article discusses the ASP.NET AJAX ModalPopupExtender control. In this article we will show how to use the ModalPopupExtender control, how to display/show/call the ASP.NET AJAX ModalPopupExtender control from javascript, how to show/display/cal…
In .NET 2.0, Microsoft introduced the Web Site.  This was the default way to create a web Project in Visual Studio 2005.  In Visual Studio 2008, the Web Application has been restored as the default web Project in Visual Studio/.NET 3.x The Web Si…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Suggested Courses

705 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