0

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...

3
Contributors
6
Replies
8
Views
6 Years
Discussion Span
Last Post by ruchi18
0

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.

0

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

0

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);
0

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

0

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 ...

0

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..

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.