Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Store Connection String
Message
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Environment versions
Environment:
VB 9.0
OS:
Vista
Network:
Windows 2008 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
01358780
Message ID:
01358900
Views:
24
I'm a bit confused - the app.config file is compiled with the app, isn't ? Remember, I would like a way to read an INI file based on the location I'm working at.

Why not just use am.INI file, like the old days?


>>How can I store a DB connection string with my C# project? I have different string determined by where I'm working at, so I'd like make it work around that.
>
>If it's a desktop app save in the app.config file, for a web app saving it in the web.config file. Something like:
>
>Desktop:
>
>
><configuration>
>  <appSettings>
>   <add key="connection" value="connection string here"></add>
>  <appSettings>
></configuration>
>
>
>Read it with:
>
>
>   using System.Configuration;
>   //
>   string connString = ConfigurationSettings.AppSettings("connection");
>
>
>Web:
>
><connectionStrings>
>  <add name="connection" connectionString="conn string here"/>
></connectionStrings>
>
>
>Read it with:
>
>System.Configuration.ConnectionStringSettings connSetting = System.Web.Configuration.WebConfigurationManager.ConnectionStrings["connection"];
>string connString = connSetting.ConnectionString;
>
Everything makes sense in someone's mind
public class SystemCrasher :ICrashable
In addition, an integer field is not for irrational people
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform