Search results
ConfigurationManager.ConnectionStrings - will read the connection string. var conn1 = ConfigurationManager.ConnectionStrings["conn1"].ConnectionString;
23 lip 2022 · .NET Framework 2.0 introduced new classes in the System.Configuration namespace to simplify retrieving connection strings from configuration files at run time. You can programmatically retrieve a connection string by name or by provider name.
12 lis 2024 · You can then read the connection string using the ConfigurationManager API in your context's OnConfiguring method. You may need to add a reference to the System.Configuration framework assembly to be able to use this API.
All connection strings in one place. Find the syntax for your database connection using ADO.NET, ADO, ODBC, OLEDB, C#, VB, VB.NET, ASP.NET and more.
Connection strings can be a bit obscure and are often not defined consistently. This article straightens things out and sheds some light on how connection strings are used to connect an application to a data source. Written by: Sebastian Affakes
This post demonstrates how to store and retrieve connection strings from app.config file of a C# .Net Windows application. The procedure is same for ASP.NET applications also except that the connection strings are stored in web.config file instead of app.config.
Demonstrates how to store and retrieve connection strings in configuration files. Describes how to configure provider-specific connection strings for SqlClient, OracleClient, OleDb, and Odbc. Demonstrates techniques for protecting information used to connect to a data source.