Click here to Skip to main content
15,885,546 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want to add a file in my project that is global to my project (database connection file). So, if I make a change to the connection string in that file, the change will affect all code that uses that connection string.

Is there a predefined method of sharing a connection string in C# (Visual Studio 2008)?

can oyu tell step by step plez
m new in c#.net

this is window based application

plez tell in proper way its urgent
Posted
Updated 28-Jan-10 1:49am
v4

Store the connection string in your project settings.

What I like to do is store several connection strhings in the project settings, then have another setting that indicates which of those settings to pick from. Makes debugging easier, as you can switch connection strings without having to store them somewhere else.
 
Share this answer
 
First of all, you need to indicate if you are working with Windows Forms (most likely), ASP.net (less likely), or WPF (least likely). Second of all, that link I sent you shows you how to use settings... step by step. Read it.
 
Share this answer
 

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