Click here to Skip to main content
15,885,366 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 189.8K   5.9K   28  
How to configure a connection string at runtime for a Windows application using C#
<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <connectionStrings>
    <add name="con" providerName="System.Data.sqlclient" connectionString="Data Source=localhost\sqlexpress;Initial Catalog=santhoshII;Integrated Security=SSPI;" />
  </connectionStrings>
</configuration>

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