Get connection string from Web.Config in n-tier application

Johann Montfort posted at 08-May-08 12:33

Dear All,

I have created an n-tier application, consisting of the UI, WCFService, ServiceLayer, and DAL.  I want these to be independent of each other, since they can be moved on different servers.

Now in the DAL, I encountered a problem.  how can I call the connection string from the Web.Config file?  Normally, when the DAL is part of the whole project, I used to call it something like this:-

string strConnectionString = ConfigurationManager.AppSettings["ConnectionString"].ToString();

However now, the DAL is in a different project altogether.  How can I reference this?

Your help is very much appreciated.

Thanks

Johann


Click here to sign in and reply. You could earn money via our $500 contest just for being helpful.
  Get connection string from Web.Config in n-tier application - Johann Montfort  08-May-08 12:33 12:33:59 PM
      hmm...Is this possible - santhosh kapa  08-May-08 01:00 1:00:58 PM
      Get Connection String - Kevin Davis  08-May-08 01:04 1:04:26 PM
      try this... - Vasanthakumar D  09-May-08 12:04 12:04:05 AM
      Use Webservice - Sujit Patil  09-May-08 12:11 12:11:24 AM
          all data retreiving will be in the DAL - Johann Montfort  09-May-08 03:55 3:55:46 AM
              Yes; just follow this - Sujit Patil  09-May-08 04:42 4:42:03 AM
              better approach - santhosh kapa  09-May-08 04:47 4:47:50 AM
                  new layer - Johann Montfort  09-May-08 05:23 5:23:03 AM
                      hmm..take these into consideration - santhosh kapa  09-May-08 06:19 6:19:19 AM
View Posts