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

DB Path

Status
Not open for further replies.

WestView

Technical User
Jan 7, 2003
67
US
Hello All,

I'm trying to create a community calendar using some code I discovered in a tutorial I found on Macromedia's site. [link]http://www.macromedia.com/devnet/mx/dreamweaver/articles/aspnet_calendar.html[/url]
Code:
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.OleDb" %>
<%@ Import Namespace="System.Xml" %>
<script runat="server">

DataSet ds = new DataSet();
protected void Page_Load(Object Src, EventArgs E)
{
	string connectionstring = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="+ Server.MapPath("aspnet_calendar.mdb") +";";
	string sql = "select * from events";

The connection path is something like: c:\root\dir1\dir2\database\aspnet_calendar.mdb

I've written it dozens of ways and nothing works. Help!!!

Thanks for any/all advice,

- Tom
 
The Server.MapPath allows you to pass a virtual path so you can get the full path returned. e.g.

If you have an application named MyApp in thw folder and your db is stored in the "db" folder, you would have:

Application: c:\inetpub\Database: c:\inetpub\
Then you could assign the datasource using:
Code:
Dim DBPath as String = Server.MapPath("db/MyDb.mdb")

Hope this helps.


----------------------------------------------------------------------

Need help finding an answer?

Try the search facilty ( or read FAQ222-2244 on how to get better results.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top