Passing connection information from Application to class library.
-
Hi all, I have created a class library for my application. I have some typed datasets in this class library. While creating the datasets , VS asked me whether to save the connection string in the config file and it created a seperate app.config file in the class library. What i need is that while calling the class library, i should be able to pass in the connection parameters from my applications web.config file and it should not create ant app.config file. How can i do this??? Any help would be kindly apperciated...
When you fail to plan, you are planning to fail.
-
Hi all, I have created a class library for my application. I have some typed datasets in this class library. While creating the datasets , VS asked me whether to save the connection string in the config file and it created a seperate app.config file in the class library. What i need is that while calling the class library, i should be able to pass in the connection parameters from my applications web.config file and it should not create ant app.config file. How can i do this??? Any help would be kindly apperciated...
When you fail to plan, you are planning to fail.
Add reference System.Configuration namespace to your class libarary. Use ConfigurationManager.ConnectionStrings["YourConnectionStringNameFromWeb.Config"] in your in the class library. Therefore when this class libarary is called in the asp.net web application, it automatically get the connection string from web.config.