Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium


Set ConnectionString of Enterprise Library 4.1 at class library from web.config

Posted on 2009-02-09
Medium Priority
Last Modified: 2013-11-25
Hi Experts,,

I have created a new project having 2 projects ( web and class library). However i need to have all data access classes embedded on the class library so i need to pass the connection string from the web.config to class library then assign to enterprise library database factory then execute.

What is the best way for doing this ??

Question by:Abu Hamdan
1 Comment

Accepted Solution

Abu Hamdan earned 0 total points
ID: 23595225
Problem solved by using this code:

   public static Database CreateDatabase()
            string connectionString = App_Settings.portalCnnStr;
            DbProviderFactory provider =
            return new GenericDatabase(connectionString, provider);   // dbProviderFactory = System.Data.SqlClient


Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
In real business world data are crucial and sometimes data are shared among different information systems. Hence, an agreeable file transfer protocol need to be established.
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…

564 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question