Search results
ConfigurationManager.ConnectionStrings - will read the connection string. var conn1 = ConfigurationManager.ConnectionStrings["conn1"].ConnectionString;
31 sty 2024 · How to Read Connection Strings From the ConnectionStrings Section. Once we have the configuration object, let’s use it to read values from the configured sources. For database connection strings, the standard way to store them in the JSON settings file is under the ConnectionStrings section:
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.
Use the ConfigurationManager.ConnectionStrings property to get a collection of connection strings defined in the web.config file. You can then use the ConnectionString property of the ConnectionStringSettings object to get the value of a specific connection string by name. Here's an example: string connectionString = ConfigurationManager.
Creates a connection string by adding key/value pairs, one at a time, to an empty DbConnectionStringBuilder. Assigns a complete connection string to the ConnectionString property of the DbConnectionStringBuilder instance, and modifies a single key/value pair within the string.
26 kwi 2015 · In order to create a connection between machines, one of them has to listen for incoming connections on a specific port number, this listening routine is done with the TcpListener object. The TcpListener can accept the connection, and provide a TcpClient socket as a result.