Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Writing to the Config File
Message
Information générale
Forum:
ASP.NET
Catégorie:
The Mere Mortals .NET Framework
Divers
Thread ID:
00944011
Message ID:
00944075
Vues:
17
Hi Shawn,

I used the code from: http://www.thecodeproject.com/csharp/ReadWriteXmlIni.asp

And I have code like this in there:
Config AppConfig = new Config(strConfigFileName);
AppConfig.GroupName="";
string strKey = AppConfig.GetValue("databases",@"xCase\Connection",@"Data Source=c:\development\xcase7;Provider=VFPOLEDB.1");
and
Config AppConfig = new Config(strConfigFileName);
AppConfig.GroupName="";
AppConfig.SetValue("databases",@"xCase\Connection","Data Source="+strxCaseLocation+";Provider=VFPOLEDB.1");
As you can see, I use it set set the string for a VFP free table directory, but this should give you enough pointers to make it work.
Also, the benefit for this, compared to the regular .NET way of getting the setting, is that you don't have to restart the app to 'see' the new value.

>Hi All,
>I have been looking through the Help File and found the section that writes a custom config file.
>
>What I would like to do is replace one line in my config file with a user enter value
>
>the one line is :
>
>	<databases>
>		<add key="MyDB\Connection" value="server=(local);uid=zzz;pwd=aaaa;database=qqqqq;" />
>	</databases>
>
>
>I want to replace this line with what the user entered for there connection info. so it would appear as follows
>
>	<databases>
>		<add key="MyDB\Connection" value="server=192.192.192.192;uid=joeSchmo;pwd=justJoe;database=RealTV;" />
>	</databases>
>
>
>TIA

hth,
Frank Camp
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform