Solved

net windows app.config change setting for sqlconnection in build

Posted on 2009-07-06
4
518 Views
Last Modified: 2013-12-17
Hi

Have windows application in c# (.net) and using sql express - when developing have sqlconnection string in settings to local but when create exe for user/distribution I want to change the connection string in the app.config file

I thought it would fit in build events (pre or post) but cannot find code snippet to change values to user setting and after buil;d bakcto development

any ideas on code syntax or is there a better way to do it

Rgds
stephen
0
Comment
Question by:stephenwilde
  • 2
4 Comments
 
LVL 69

Accepted Solution

by:
Éric Moreau earned 250 total points
ID: 24783991
0
 
LVL 13

Assisted Solution

by:Philip Pinnell
Philip Pinnell earned 250 total points
ID: 24783995
0
 

Author Comment

by:stephenwilde
ID: 24784077
Thanks

But in app config file using an application variable not full connection string for which is no option in my visual studio winddows application to do - and the syntax in pre/post build seems dos like dont wont 2 app config files to maintain as lots of other items/settings in them so would need syntax to change only a value

Rgds
stephen
0
 

Author Closing Comment

by:stephenwilde
ID: 31600100
Thanks
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Nowadays, some of developer are too much worried about data. Who is using data, who is updating it etc. etc. Because, data is more costlier in term of money and information. So security of data is focusing concern in days. Lets' understand the Au…
This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now