how to get the connectionstring from app.config after creating the exe?

Posted by Prabu_Spark under ASP.NET on 2/14/2013 | Points: 10 | Views : 1861 | Status : [Member] | Replies : 3
Hi sir,
I want to get the connectionstring from app.config after creating the exe. After creating the exe, i installed in another
machine, where login credential is different for sql server. How to edit the app.config value after installed in another
machine. Kindly give me the solution for this problem.


[Hint: I developed one windows application used to store the information in the database. I created the exe and installed in
another machine, but it shows login failed for user sa. I want to change the connectionstring value in app.config]

With regards,
J.Prabu.
[Email:prbspark@gmail.com]



Responses

Posted by: Sireesha on: 2/14/2013 [Member] Starter | Points: 25

Up
0
Down
The app.config (or as appname.exe.config as it ends up in the bin dir) is a plain ascii file the client can edit with an editor of his choice.
I get the idea that you are under the impression that the contents of the app.config get merged into the exe at compile time,
this is not the case.

A.Sireesha

Prabu_Spark, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Sireesha on: 2/15/2013 [Member] Starter | Points: 25

Up
0
Down
After creating exe file and whenever we will give it to client the bin folder will contain
2 files app.config file and exe.config file and exe.config file will look same as app.config file and just like how we change connection string in app.config file we can do the same process in exe.config file..
This will happens only if we will include app.config file in our application ..



A.Sireesha

Prabu_Spark, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Raj.Trivedi on: 2/17/2013 [Member] [MVP] Starter | Points: 25

Up
0
Down
Hello Prabhu_Spark

Go to the folder where you exe is installed there will be exe.config file and there you can edit the connection string.


Regard's
Raj.Trivedi
"Sharing is Caring"
Please mark as answer if your Query is resolved

Prabu_Spark, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response