If you create an ASP.NET application VS.NET automatically creates one.
You will find a Web.Config file in the root of the Web.

If you are building a Windows Forms application create a file in the
directory of the EXE called the same name as the application .config

Example:
MyApplication.Exe - Application
MyApplication.Exe.Config - Application Config file

In the file place the following:

<configuration>
        <appSettings>
        <!--Please don't add the system administrator account to this
file -->
                <!-- Development account
                -->
                <add key="databaseconnection"
value="server=MyServer;uid=MyUserID;pwd=MyPassword;database=MyDatabase"
/>
        </appSettings>
</configuration>

You then use the following code to get the connection string
ConfigurationSettings.AppSettings.GetValues("databaseconnection").GetVal
ue(0).ToString()

Later

-----Original Message-----
From: Daniel Morgan [mailto:[EMAIL PROTECTED]]
Sent: Monday, April 22, 2002 9:53 PM
To: [EMAIL PROTECTED]
Subject: Re: [DOTNET] Storing ADO.NET Connection String Parameters

Can you tell me more about these Config files?

-----Original Message-----
From: dotnet discussion [mailto:[EMAIL PROTECTED]] On Behalf Of
Keith A Franklin
Sent: Monday, April 22, 2002 10:01 PM
To: [EMAIL PROTECTED]
Subject: Re: [DOTNET] Storing ADO.NET Connection String Parameters

Config files are the standard way to store things like connection
strings.

-----Original Message-----
From: Daniel Morgan [mailto:[EMAIL PROTECTED]]
Sent: Monday, April 22, 2002 8:14 PM
To: [EMAIL PROTECTED]
Subject: [DOTNET] Storing ADO.NET Connection String Parameters

Is there an official Microsoft .NET way to store ADO.NET Connection
String parameters?  If not, what do you recommend for storing connection
data for an ADO.NET data source?  I would assume storing it in some XML
format.

You can read messages from the DOTNET archive, unsubscribe from DOTNET,
or
subscribe to other DevelopMentor lists at http://discuss.develop.com.

You can read messages from the DOTNET archive, unsubscribe from DOTNET, or
subscribe to other DevelopMentor lists at http://discuss.develop.com.

Reply via email to