hello
I have to read Connection String that we usually defined in web config n reading through Configuration manager but I have to access that connection string in class library which I defined in separate project as making my project with 3 tier architecture but ConfigrationManager is not recognized in the class however i import System.Configuration so please help me out in this...

Recommended Answers

All 6 Replies

Do not add the reference of System.Configuration.Dll in DAL/BAL. You shoul have to pass "connectionString" from your web-app to the Class library's component (class) via method parameter.

How to read through parameters please explain a bit more...

I'm talking about method parameter (argument),

Consider this is your DAL component,

public class DalMain
{
   private static string _cnstr;
   public static void SetConnectionString(string cnstr) {
      _cnstr=cnstr;
   }
}

In your web-app,

//read connection string from the web.config 
string  cnstr=System.Configuration.ConfigurationManager.ConnectionStrings["key"].ConnectionString;
DalMain.SetConnectionString(cnstr);

this is the issue if a define
"string cnstr=System.Configuration.ConfigurationManager.ConnectionStrings["key"].ConnectionString;" in class liberary ie. suppose to be DalMain class then it not regonized CongiguraionManager so where should i define this.. connection string

hi everyone
i want to pass values from webpage which is in asp.net to window form application .like i have button on asp.net whenevr i click on that button on the window form application its written button1 is pressed. how to code this program ? please help me ...

dear you post your thread at wrong place in you account you have a link in right side create new thread there you can post it..

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.