Click here to Skip to main content
15,867,756 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi dears,
in my program, i have a app.config file,
when i want use appsetting, i write below code:
<pre lang="c#">ConfigurationSettings.AppSettings[0].ToString();

my app.config code is here:
C#
<?xml version="1.0"?><configuration>
  <appSettings>
    <add key="connectionString" value="Data Source=.\sql2008;Initial Catalog=dbCar;Integrated Security=True"/>
  </appSettings>
  <startup>
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
  </startup>
</configuration>

i want change value like below,
C#
Data Source=.\mssql;Initial Catalog=dbCar;Integrated Security=True

but i don't know how i can change it?.
Posted
Updated 14-Mar-14 3:17am
v3
Comments
Tejas Vaishnav 14-Mar-14 9:38am    
what you want to do, you want to change your connection string at run time during your program is running or you just need to change your connection string statically in your app.config..

1 solution

This is very simple, all developer know this even just beginners also know this.
You just take your my sql database connection string and paste it as value.

Look this link for My sql connection stringClick here[^]

Thanks,
-RG
 
Share this answer
 

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