Solved

ConfigurationManager is Not Declared????

Posted on 2009-07-02
2
821 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 ITIL 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

This tutorial demonstrates one way to create an application that runs without any Forms but still has a GUI presence via an Icon in the System Tray. The magic lies in Inheriting from the ApplicationContext Class and passing that to Application.Ru…
A while ago, I was working on a Windows Forms application and I needed a special label control with reflection (glass) effect to show some titles in a stylish way. I've always enjoyed working with graphics, but it's never too clever to re-invent …
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

808 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