Click here to Skip to main content
15,886,074 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi to all,
I am new to WPF. I want to maintain my connectionString in App.config file.
How can I maintain it? I am using VS2010 WPF, SQLServer 2005.
Posted
Updated 10-Aug-10 3:01am
v2

It's ok. Even if you are new to WPF, it's not much different from normal Winforms programming or Web programming in case of keeping ConnectionString in Config file.

Further, once the connection string is defined in the config file, it would not get automatically changed. It will remain the same as long as you yourself don't change it manually or by code.

Just put the Connection String in your config file as you put other values in it and access it when needed.
 
Share this answer
 
Comments
satyagrahi_2010 11-Aug-10 1:05am    
Reason for my vote of 3
somewhat information
i guess ,the connection string remains the same weather u are working on wpf or simple .net application


if your database is still attatched to the sql server then use the following connection string

<add name="cs" connectionString="server=.;database="mydatabase" uid=sa"/>

hope it works. :)
 
Share this answer
 
Comments
satyagrahi_2010 11-Aug-10 1:10am    
Reason for my vote of 3
somewhat information

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