IQ DIRECT

How to read connection string from App.config

Navigation

  • Home
  • About us
  • Portfolio
  • Reviews
  • Blog
  • Contacts

How to read connection string from App.config

If you are writing console application in C# and need to use the database connection, probably you would like to store the connection string in the App.config file. This is a common practice for C#.NET applications. But how to read the connection string from the file? See the answer below: 

 

ConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings["ConnectionStringName"].ConnectionString;

Copyright ©2025 IQ DIRECT


main version