hanis29268
جمعه 23 اسفند 1392, 17:01 عصر
سلام،
بنده یه برنامه دارم که در درون آن فایل App.config وجود داره، یه connection داخلش دارم که میخوام تغییرش بدم، کسی میدونه چطور میشه اونو تغییرش داد؟؟
کد:
<?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>
وقتی میخوام این connection رو بخونم از کد زیر استفاده میکنم، ولی وقتی میخوام تغییرش بدم مثلا datasource رو عوض کنم نمیدونم چطوری باید این کارو کنم؟؟
ConfigurationSettings.AppSettings[0].ToString();
با تشکر فراوان
بنده یه برنامه دارم که در درون آن فایل App.config وجود داره، یه connection داخلش دارم که میخوام تغییرش بدم، کسی میدونه چطور میشه اونو تغییرش داد؟؟
کد:
<?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>
وقتی میخوام این connection رو بخونم از کد زیر استفاده میکنم، ولی وقتی میخوام تغییرش بدم مثلا datasource رو عوض کنم نمیدونم چطوری باید این کارو کنم؟؟
ConfigurationSettings.AppSettings[0].ToString();
با تشکر فراوان