To define all connections in the program, a new node is added within the node. In our case, since we have created a console application project, we should have an App.config file in the project, which currently has the following definition: Although the application can also use other ways to define the configuration. In desktop application projects it is App.config file, while in web applications it is mostly Web.config file. A much more flexible path represents its definition in special configuration files of an application. its definition in application code) is usually rarely used. Hard coding of the connection string (i.e. Integrated Security: establishes authentication.Initial Catalog: indicates the name of the database on the server.If the database server name is different, then it should be used accordingly. Since a slash is used in the string, the character is placed at the beginning of the string. Data Source: points to the server name.In this case, to connect to the previously created usersdb _1 database, we define the connection string from three parameters: The connection string represents a set of parameters in the form of key=value pairs. The connection string represents a set of parameters
#Sql server connection string persist security info how to#
How to Create Connection String For SQL Server.To connect to the database, we need to create and use the SqlConnection object.The connection string represents a set of parameters.