tags:

views:

46

answers:

2

Hello everyone, I have 2 projects in one solution. How can I change both connection string in one of them?

+1  A: 

Have the connectionstring in one project and expose it by a method that returns the connectionstring. The other project references the first and uses that method at all places that require a connectionstring.

Be aware, that this only makes sence if both projects can be referenced logically. If not use a third project, that only contains the connectionstring and exposes it by such method.

citronas
A: 

What you probably need is a shared app.config and this can be done very easily with linked files within Visual Studio.

In the screenshot below you can see how it's done: Add As Link

Jochen
How can I do it by code?
baran
Can you make your question more clear? Do you have 2 exe's that need to share the same connectionstring? And you only want to configure it once?
Jochen