Click here to Skip to main content
14,207,832 members
Click here to Skip to main content
Add your own
alternative version


15 bookmarked
Posted 9 Aug 2004

Dynamic connection string

, 9 Aug 2004
Rate this:
Please Sign up or sign in to vote.
Creating dynamic connection string on a remote site.


Well, often I hear the problem of creating a connection sting on a remote site, because people don't have physical path to the location of their site database or any other thing for that method.

Over here, I will show how to create a connection string. This tutorial is for beginners and intermediate web developers, and the advance developer will know this already.

First, always use relative paths to make a site, and the paths to the database used in your website should also be relative. There is a built-in function in ASP and also in ASP.NET since it's a server method.

server.mappath("relative path") method is used to create physical path for the required file.

For example, I have a file called sitedata.mdb which is in a folder site_assert, and I am creating a path in a page which is in the parent folder. Then, this should be done:

strconn = server.mappath("site_assert/sitedata.mdb")

This assigns the physical path to the variable strconn, which you can further use.


This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


About the Author

Pakistan Pakistan
well i am just a intermediate programmer and will like to help people out coz i am stuffed with stupid little things

Comments and Discussions

QuestionSo simply!? Pin
figofuture9-May-06 20:39
memberfigofuture9-May-06 20:39 
GeneralPls Help me Emergently! HTML WYSIWYG Editor Using ASP/VBScript/JScript Pin
AlexDa13-Mar-06 0:13
memberAlexDa13-Mar-06 0:13 
Questionhow to create an html editor Application(internet Explorer -Editing) Pin
AlexDa13-Mar-06 0:11
memberAlexDa13-Mar-06 0:11 
how to create an html editor Application(internet Explorer -Editing)
GeneralNEVER put dBs within your site path! Pin
benhereb43-Aug-05 17:36
memberbenhereb43-Aug-05 17:36 
QuestionWhat is the use? Pin
Thomas Lykke Petersen10-Aug-04 3:09
memberThomas Lykke Petersen10-Aug-04 3:09 
Generalf u c k you, spam maker Pin
rgf5679-Aug-04 23:40
memberrgf5679-Aug-04 23:40 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Cookies | Terms of Use | Mobile
Web02 | 2.8.190612.1 | Last Updated 10 Aug 2004
Article Copyright 2004 by x_scripterx
Everything else Copyright © CodeProject, 1999-2019
Layout: fixed | fluid