Search results
ConfigurationManager.ConnectionStrings - will read the connection string. var conn1 = ConfigurationManager.ConnectionStrings["conn1"].ConnectionString;
26 maj 2011 · Then you can use this Method that returns the connection string to be ready to passed to the sqlconnection object to continue your work as follows: private string ReturnConnectionString() { // Put the name the Sqlconnection from WebConfig.. return ConfigurationManager.ConnectionStrings["DBWebConfigString"].ConnectionString; }
31 sty 2024 · Then, let’s use the GetConnectionString() method of the Configuration object to read our connection string from the settings file: IConfiguration configuration = builder.Build(); var connString = configuration.GetConnectionString("ProductsDb");
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.
22 gru 2021 · In this article we will learn about How to read connection string in .NET Core. In ASP.NET Core, configuration API provides a way of configuring an app based on a list of name-value pairs that can be read at runtime from multiple sources.
15 gru 2023 · Save and edit connection strings in .NET Framework application development with Visual Studio, or edit a connection string directly in application settings.
15 cze 2024 · The connection string aims to simplify and standardize the method through which applications connect to data sources so that developers do not need to hardcode the connection details in their code.