Print Page | Close Window

Database code

Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: ASP.NET Discussion
Forum Description: Discussion and chat on ASP.NET related topics.
URL: https://forums.webwiz.net/forum_posts.asp?TID=12160
Printed Date: 28 March 2026 at 4:57pm
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: Database code
Posted By: huwnet
Subject: Database code
Date Posted: 13 October 2004 at 1:18pm
I have some code:

Server.MapPath("db.mdb")

How do I change is into a physical path?



Replies:
Posted By: Misty
Date Posted: 13 October 2004 at 1:38pm

I am not exactly sure what folder your database is in. But I will give you some code that may help you.

        Dim path


        path = Server.MapPath(".")
          path = Replace(path,"html","database") - assuming that your database is in a database folder outside the html folder.

        'Create Connection object
        strConnect    = "Provider=Microsoft.Jet.OLEDB.4.0;Data " _
                                                    & "Source=" & path & "\" & databaseName  

Did this help?



Posted By: dpyers
Date Posted: 14 October 2004 at 11:59pm

You can also preface it  with a series of ../ (or is it ..\ - lol) to back up the path from wherever you are.

On some systems, it seems to need an extra set of ../ though so you may need to experiment a little.



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

Lead me not into temptation... I know the short cut, follow me.



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net