Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't access the configuration manager from my solution

I have a three tier set-up. Someone suggested I should get the ConnectionString from the Web.Config file and I've got it set up like this:

alt text

Now I'm trying to access the ConnectionString from my DAL tier, but I can't find the ConfigurationManager. How can I invoke my Connection string from here?:

alt text

like image 966
Sergio Tapia Avatar asked Aug 31 '09 02:08

Sergio Tapia


1 Answers

Add a reference to System.Configuration, then have a using class for System.Configuration, then you will have access to:

ConfigurationManager.ConnectionStrings

And yours can be accessed via

string s = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
like image 100
Noon Silk Avatar answered Sep 19 '22 08:09

Noon Silk