Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > Other .NET > General .NET
General .NET For general discussion of MICROSOFT .NET topics that don't fall within any of the other .NET forum subcategories or .NET language forums.  If your question is specific to a language (C# or Visual Basic) or type of application (Windows Forms or ASP.Net) try an applicable forum category. ** PLEASE BE SPECIFIC WITH YOUR QUESTION ** When posting here, provide details regarding the Microsoft .NET language you are using and/or what type of application (Windows/Web Forms, etc) you are working in, if applicable to the question. This will help others answer the question without having to ask.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the General .NET section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old July 9th, 2004, 02:45 AM
Authorized User
Join Date: May 2004
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Default Setting Dynamic Connection String


I am using an ASp page with dot not Application. In that Asp Page,

I connected to the SQl server using this connection String

DRIVER={SQL Server};SERVER=aplnserver;UID=nicuser;PWD=nicadmin ;DATABASE=AHDB

But I want this connection string as dynamic, that is

specify this in web.config page and call from that using
these type as setting as dynamic from asp. System.Configuration.ConfigurationSettings.AppSett ings.Get("DSN")

Is it possible? Or any alternate way to solve this problem.
Please guide me

With Regards
Old July 9th, 2004, 08:19 AM
planoie's Avatar
Friend of Wrox
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts

Add this under the <configuration> of your web.config file:

    <add key="CONNSTRING" value="your connection string" />

Then you can access within the application like this:

ConfigurationSettings.AppSettings.Item("CONNSTRING ")

Is this what you are looking for?

Work smarter, not harder

Similar Threads
Thread Thread Starter Forum Replies Last Post
Connection String setting at runtime TwoTrees BOOK: Professional ASP.NET 3.5 : in C# and VB ISBN: 978-0-470-18757-9 3 July 2nd, 2010 11:41 AM
Setting dynamic values for @parms bsullins BOOK: Professional SQL Server Reporting Services ISBN: 0-7645-6878-7 1 February 17th, 2005 03:20 PM
setting connection string in the web.config ACE2084 ADO.NET 2 January 6th, 2005 04:33 PM
Dynamic connection string from ASP page jayaraj Classic ASP Databases 2 July 12th, 2004 07:44 AM
Dynamic connection string from ASP jayaraj General .NET 1 July 12th, 2004 04:19 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.