Click here to Skip to main content
15,880,905 members
Articles / Web Development / IIS
Article

Dynamic connection string

Rate me:
Please Sign up or sign in to vote.
2.45/5 (6 votes)
9 Aug 2004 56.8K   15   6
Creating dynamic connection string on a remote site.

Introduction

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:

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

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

License

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


Written By
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
figofuture9-May-06 20:39 
GeneralPls Help me Emergently! HTML WYSIWYG Editor Using ASP/VBScript/JScript Pin
AlexDa13-Mar-06 0:13
AlexDa13-Mar-06 0:13 
Pls Help me Emergently

HTML WYSIWYG Editor Using ASP/VBScript/JScript (IE editing)
Questionhow to create an html editor Application(internet Explorer -Editing) Pin
AlexDa13-Mar-06 0:11
AlexDa13-Mar-06 0:11 
GeneralNEVER put dBs within your site path! Pin
benhereb43-Aug-05 17:36
benhereb43-Aug-05 17:36 
QuestionWhat is the use? Pin
Thomas Lykke Petersen10-Aug-04 3:09
Thomas Lykke Petersen10-Aug-04 3:09 
Generalf u c k you, spam maker Pin
rgf5679-Aug-04 23:40
rgf5679-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.