SQL server connectivity using ConfigurationManager.ConnectionString
I am not able to use
String connectionString = ConfigurationManager.ConnectionStrings["DevBackup"].ConnectionString;
I am getting error 'The nam开发者_JS百科e 'ConfigurationManager' does not exist in the current context'
I have used namespacesusing System.Data.SqlClient;
using System.Data.Sql;
what should be done..?? Am I missing something..??
You need to add a reference to the System.Configuration
assembly to your project, and then a using System.Configuration;
statement to your app.
Do you also have System.Configuration
in your namespaces?
For ASP.NET, System.Web.Configuration
is the correct namespace to use:
using System.Web.Configuration;
String connectionString = WebConfigurationManager.ConnectionStrings["DevBackup"].ConnectionString;
精彩评论