ASP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingASP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old July 2nd, 2003, 03:52 AM
Mill Mill is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Nov 2002
Posts: 3 Mill User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Question OleDbConnection and Server.MapPath

At work, I'm a Management Information person/ Small Systems Analyst at a UK University.

In my spare time, (and totally unrelated to work!) I am trying to set up a web site to gather information into a database. I have never previously done any web-based work.

I considered going down the path of PHP and MySQL, but being already familiar with the Microsoft stable, have set myself up to use ASP.NET through Visual Studio.Net (Architect) on a Windows XP Pro platform.

MS Access has always suited me for simple manipulation and analysis work - and so I have elected to use an Access database with my website.

My Question:
Would it be possible for someone with VS.NET experience to tell me how to set up an OleDbCOnnection Object to use the Server.MapPath function to find its datasource.

The OleDbConnection object wizard insists on being given the full path to the database. This is fine on my development machine, but when I get around to deploying my site to the (3rd party) web server, not being party to server drive structures - I will have problems. My Web hosting company has suggested I use MapPath (but cannot tell me how..)

This has frustrated my progress for a couple of weeks now and I would be very grateful for any help/guidance.

Many thanks for taking the time to read this!


Mill

Reply With Quote
  #2  
Old July 2nd, 2003, 05:30 AM
stumpy's Avatar
stumpy stumpy is offline
May contain nuts.
Dev Articles Regular (2000 - 2499 posts)
 
Join Date: Aug 2002
Location: Sydney, AU
Posts: 2,058 stumpy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 h 8 m 57 sec
Reputation Power: 9
Send a message via ICQ to stumpy Send a message via MSN to stumpy
Speaking from the ASP side of things (I'm sure it's almost identical in VS.NET), the mapPath method simply returns an absolute path when given a relative path.

varAbsPath = server.mapPath("lib/db/product.mdb")

The value of varAbsPath would be, for example,
"d:\inetput\wwwroot\bob_website\lib\db\products.mdb "
__________________
DevArticles Moderator
BlueSix - Web Development and Consulting

Reply With Quote
  #3  
Old July 3rd, 2003, 04:33 AM
Mill Mill is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Nov 2002
Posts: 3 Mill User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Many thanks Stumpy - you are of course absolutely correct.

Does anyone out there actually use VS.NET to produce ASP.NET web apps?

I somehow need to get the result of the MapPath function into the connection string of my OleDbConnection.

Am I missing something? I can't believe that this is so difficult..

Reply With Quote
  #4  
Old July 3rd, 2003, 04:42 AM
stumpy's Avatar
stumpy stumpy is offline
May contain nuts.
Dev Articles Regular (2000 - 2499 posts)
 
Join Date: Aug 2002
Location: Sydney, AU
Posts: 2,058 stumpy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 h 8 m 57 sec
Reputation Power: 9
Send a message via ICQ to stumpy Send a message via MSN to stumpy
Yeah - you must be missing something :P

There's thousand of .NET primers/tutorials out there on the net these days, just google!

http://www.fawcette.com/vsm/2002_07.../default_pf.asp - here's the first one i found!

Reply With Quote
  #5  
Old July 3rd, 2003, 05:00 AM
Mill Mill is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Nov 2002
Posts: 3 Mill User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
They don't call me 'Junior Member' for nothing

Thanks for the link. Plenty of food for thought in there for the coming weekend. (sad man!)

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingASP Development > OleDbConnection and Server.MapPath


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway
Stay green...Green IT