views:

36

answers:

3

I am not able to use

String connectionString = ConfigurationManager.ConnectionStrings["DevBackup"].ConnectionString;

I am getting error 'The name 'ConfigurationManager' does not exist in the current context'
I have used namespaces

using System.Data.SqlClient;
using System.Data.Sql;

what should be done..?? Am I missing something..??

+5  A: 

You need to add a reference to the System.Configuration assembly to your project, and then a using System.Configuration; statement to your app.

marc_s
+1  A: 

Do you also have System.Configuration in your namespaces?

LittleBobbyTables
A: 

For ASP.NET, System.Web.Configuration is the correct namespace to use:

using System.Web.Configuration;
String connectionString = WebConfigurationManager.ConnectionStrings["DevBackup"].ConnectionString;
PhilPursglove