
The approximate form of the file “Form1.cs” ( C# programming language) can be as follows: using System Copying a string ( ConnectionString) of a database connection to a program

In this case, the database connection string specifies the full path to the database file “MyDataBase.mdf”.įigure 1. Connection string with database string ConnStr = Source=.\SQLEXPRESS AttachDbFilename=D:\Programs\C_SHARP\TermPaper1\TermPaper1\MyDataBase.mdf Integrated Security=True User Instance=True" Insert the string “Connection String” in the initialization string of the ConnStr variable (or choose a different name) as shown below:

The database was created earlier and included to the list of data ‘Server Explorer’ databases. It is assumed that the local database is located in the file “MyDataBase.mdf”. With this string application (program) can have access to the database elements (tables, views, charts, and the like). This topic shows how to determine the connection string with the ‘Connection String’ database.
