Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Reading Enterprise Library settings
Message
From
23/03/2007 15:14:30
 
 
To
23/03/2007 12:41:24
John Baird
Coatesville, Pennsylvania, United States
General information
Forum:
ASP.NET
Category:
ADO.NET
Miscellaneous
Thread ID:
01207770
Message ID:
01207930
Views:
21
>System.Configuration.AppSettingsReader, i.e.:
>
>           System.Configuration.AppSettingsReader asr = new System.Configuration.AppSettingsReader();
>           string currentTargetServerName = asr.GetValue("SQLServerName", typeof(System.String)).ToString();
>           string currentTargetDatabaseName = asr.GetValue("SQLDatabaseName", typeof(System.String)).ToString();
>
>
>
>>All,
>>
>> I have an application that uses enterprise library to connect to a database. I need to know how to read a connection string from the app.config file. How do I do it? What namespaces do I need?

Do you really need a reader?
using System.Configuration;
string SQLServerName = ConfigurationManager.AppSettings["SQLServerName"].ToString();
Fred
Microsoft Visual FoxPro MVP

foxcentral.net
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform