Get Dynamically connection string in app.config file c#

Get Dynamically connection string in app.config file c#

Today, We want to share with you Get Dynamically connection string in app.config file c#.In this post we will show you dynamic connection string in c# windows application, hear for how to get connectionstring from app config in c# class library we will give you demo and example for implement.In this post, we will learn about how to get connection string from app.config in windows application with an example.

Now in this post, I will explain Read connectionstring from app.config c# with appropriate example.

c# – Get connection string from App.config

Write below lines of ASP.NET MVC Web Configuration code to read connection string from app.configue

string _ConnectionString = System.Configuration.ConfigurationManager.AppSettings[key];

Dynamic connection string in c# windows application

First of all just Add a reference simple of System.Configuration to your main page.

using System.Configuration;

app.config fetch the data connection string as follow.

string conStr = ConfigurationManager.ConnectionStrings["pakainfo"].ToString();

How to get Connection String from App.Config in C#

Using the Code

var connectionString=ConfigurationManager.ConnectionStrings["pakainfoManagements"].ConnectionString;

Read :


You can also read about AngularJS, ASP.NET, VueJs, PHP.

I hope you get an idea about Read (Get) Connection String from App.Config file using C# and VB.Net.I would like to have feedback on my blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.