Click here to Skip to main content
15,889,315 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more: , +
I am in a situation that after i make a .exe file of my program that use ms sql database. and i need the program to run in other computer...but the data source differs from computer to computer......i need the user to provide the data source name and after the user enters the data source name the value of data source in app.config should be modified..

any idea...

also i want to use the program in network...ie the program is installed in 3-4 computer which is in lan network...and the database is installed in only one computer the main database server... all program in other computer uses the same database...how can i manage the connection string in this case??

please help
thank u
Arpan
Posted

1 solution

1) Open your projects Properties in the solution explorer, and double click on "Settings.settings"
2) In the resulting grid, change the Name to "MySetting", and set the Value to "Defaulted value". Leave Type and Scope as "string" and "User" respectively.
3) Save and close the settings window.
4) To read your setting:
string s = Properties.Settings.Default.MySetting;
5) To write your setting:
Properties.Settings.Default.MySetting = "My new setting value";
Properties.Settings.Default.Save();
 
Share this answer
 
Comments
amsainju 24-Aug-11 15:50pm    
thanks a lot

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