Click here to Skip to main content
15,896,557 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Dear Friends,

Here iam developing one Application in that application there are four Projects till now iam using Four app.config file for Connection string.So now i want to use one app.config and i want to pass one connection string file in four projects.I dont know how to do if any information please share with me.


Regards,

AnilKumar.D
Posted
Comments
BillWoodruff 24-Sep-12 8:13am    
Please tag your question: WinForms, WPF, ASP.NET ?
Sergey Alexandrovich Kryukov 24-Sep-12 13:51pm    
Sorry, what difference may it make? Config is config...
--SA
BillWoodruff 24-Sep-12 20:41pm    
We're feeling the elephant in a dark room here.

There is such a range of project types, and website project types, you can create now, particularly with VS 2012: 12 options if you select File/New/Project: six options from File/New/Website.

That I assume, having created only a few of those 18 types myself, it's possible that there is a difference in types of secondary files one, or another choice, may create.

In any case shouldn't something like a "connection string" go into a resource, not a config file ?

best, Bill
Sergey Alexandrovich Kryukov 25-Sep-12 0:09am    
Yes, that's true. Please see my comment below. With the lack of that explanation the answering would be like catching a black cat in a dark room, but the one where there is no a cat. :-)
--SA
Sergey Alexandrovich Kryukov 24-Sep-12 13:53pm    
The application type probably does not matter, but you should explain your scenario and the goals. Why would you "pass" connection string? "Pass" -- from where to where?
The question might be interesting and reasonable, but right now it is not clear. Don't forget to explain your ultimate goals.
--SA

1 solution

If your projects are under the same solution:
You can add you connection string in app.config in the root directory therefore you can use it in all the projects of that solution
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900