Solved

File names

Posted on 2004-08-12
3
141 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
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 250 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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

706 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now