Solved

net windows app.config change setting for sqlconnection in build

Posted on 2009-07-06
4
520 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

Control application downtime with dependency maps

Visualize the interdependencies between application components better with Applications Manager's automated application discovery and dependency mapping feature. Resolve performance issues faster by quickly isolating problematic components.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction In my previous article (http://www.experts-exchange.com/Microsoft/Development/MS-SQL-Server/SSIS/A_9150-Loading-XML-Using-SSIS.html) I showed you how the XML Source component can be used to load XML files into a SQL Server database, us…
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.

911 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

22 Experts available now in Live!

Get 1:1 Help Now