Search results
ConfigurationManager.ConnectionStrings - will read the connection string. var conn1 = ConfigurationManager.ConnectionStrings["conn1"].ConnectionString;
31 sty 2024 · In this article, we have learned how to read configuration strings from an application settings JSON file. Also, we have learned how to read connection strings from environment variables through the .NET Core Configuration object.
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.
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.
15 cze 2024 · In our first example, we will see how to retrieve the connection string from the appsettings.json file using a console application: var connectionString = configuration.GetConnectionString("DefaultConnection");
15 gru 2023 · In this article. To save a connection string from within the Data Source Configuration Wizard. To save a connection string directly into application settings. Edit connection strings stored in application settings. Edit connection strings for datasets. Show 2 more.
Use connection strings in other methods like this. SqlConnection conn = new SqlConnection(Config.CONNECTION_STRING_1);