Obsolete code in 2005

G

Guest

I was using the following function in .NET 2003:

Public Shared Function GetConnectionString() As String
Return ConfigurationSettings.AppSettings(DB_CONNECTION)
End Function

It is now underlined in green, and the message when I hover over it is that
this code is now obsolete, and has been replaced by :


System.Configuration!System.Configuration.ConfigurationManager.AppSettings

I can't change my code to this - it says ConfigurationManager is not a
member of configuration...

What do I do to fix this?
Thanks in advance!

Amber
 
G

Greg Burns

Yeah, this confused me for awhile too. The trick is you have to add a
reference to System.configuration.dll.

Greg
 
G

Guest

Imports System.Configuration.dll

has the green underline, and says
"doesn't contain any public member or cannot be found".

Amber
 
G

Greg Burns

amber said:
Imports System.Configuration.dll

has the green underline, and says
"doesn't contain any public member or cannot be found".

Amber

Not Imports. "Add a reference". Different concepts.

Double click on "My Project" in Solution Explorer. Click on Reference tab.
Click Add and browse for "System.configuration.dll"

Greg
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top