Solved

ConfigurationManager is Not Declared????

Posted on 2009-07-02
2
816 Views
Last Modified: 2012-05-07
I have been trying to get my connectionstring from the web.config file and both methods I have tried give errors.
I have imported the System.Configuration but I keep getting ConfigurationManager not declared.
I also tried using ConfigurationSettings.appsettings and get this is obsolete.
What am I doing wrong???
Thanks


Imports System

Imports System.Collections.Generic

Imports System.Text

Imports System.Data

Imports System.Configuration

Imports System.Data.Common

Imports System.Data.SqlClient

Imports System.Data.OleDb

Imports System.Data.Odbc

Imports System.IO
 

Namespace ApplicationFramework.DataAccessLayer

    Public NotInheritable Class DBManager

        Inherits DBManagerBase

        Public Sub OpenConnection()
 

            ConnectionString = ConfigurationManager.ConnectionStrings("ConnectionString").ConnectionString

          

          '  ConnectionString = ConfigurationSettings.AppSettings("ConnectionString").ToString

            MyBase.Open(ConnectionString)

        End Sub

Open in new window

0
Comment
Question by:Sheritlw
2 Comments
 
LVL 9

Accepted Solution

by:
Rahul Goel earned 500 total points
ID: 24769746
You have to add "System.Configuration" as a reference and it will work.
0
 

Author Closing Comment

by:Sheritlw
ID: 31599453
Thank you!
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article explains how to create and use a custom WaterMark textbox class.  The custom WaterMark textbox class allows you to set the WaterMark Background Color and WaterMark text at design time.   IMAGE OF WATERMARKS STEPS Create VB …
1.0 - Introduction Converting Visual Basic 6.0 (VB6) to Visual Basic 2008+ (VB.NET). If ever there was a subject full of murkiness and bad decisions, it is this one!   The first problem seems to be that people considering this task of converting…
Delivering innovative fully-managed cloud services for mission-critical applications requires expertise in multiple areas plus vision and commitment. Meet a few of the people behind the quality services of Concerto.
Need to grow your business through quality cloud solutions? With everything required to build a cloud platform and solution, you may feel like the distance between you and the cloud is quite long. Help is here. Spend some time learning about the Con…

919 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now