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...
ruchi18
0
Light Poster
Recommended Answers
Jump to PostDo 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.
Jump to PostI'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);
All 6 Replies
kvprajapati
1,826
Posting Genius
Team Colleague
ruchi18
0
Light Poster
kvprajapati
1,826
Posting Genius
Team Colleague
ruchi18
0
Light Poster
wajiha irfan
0
Newbie Poster
ruchi18
0
Light Poster
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.