Click here to Skip to main content
15,896,453 members
Articles / Programming Languages / C#

Configuring a Connection String in the App.Config File During Runtime in C#

Rate me:
Please Sign up or sign in to vote.
4.80/5 (13 votes)
28 Jun 2012CPOL1 min read 190.2K   5.9K   28  
How to configure a connection string at runtime for a Windows application using C#
using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;

namespace ConnectionstringatRuntime
{
    static class Program
    {
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread]
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new Form1());
        }
    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Technical Lead EF (Education First)
India India
I graduated as Production Engineer and started my career as Software Developer then worked as tester for a while before moving into Windows application development using Microsoft Technologies. But for the last few years i am working on javascript, React, Node, AWS, Azure Chatbots

Comments and Discussions