Am 23 Jan 2006 02:09:35 -0800 schrieb Vijayata:
Hi,
Can anyone help me for how to access connection string defines in
App.config file in an Windows form application.
I`m doing project in C#.NET and SQL Server2000.
So you are also pleased to give me suggestions on the above mentioned
platforms.
Thanks.
Hi,
to read the connection string out of your app.config file in your
application try something like this (e.g. for Oracle):
String myConnection =
ConfigurationSettings.AppSettings["connectStringORA"];
myConn = new OracleConnection(myConnection);
Your app.config file looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<appSettings>
<add key="connectStringORA" value="Data Source=xxx;" />
</appSettings>
</configuration>
To learn more about connection strings, this page is quite interesting:
http://www.connectionstrings.com/
Bye
Horst