C # BD .mdf connection string

1

Good evening guys, I have a .mdf database in a Windows Forms and I want to make the connection string it, can anyone help me? My version of Visual Studio is 2015 and the file is in: C: Documents \ Visual Studio 2017 \ Projects \ Projects \ Final Work POO \ Final Work POO \ BD.mdf

    
asked by anonymous 11.05.2018 / 04:49

1 answer

1

You can get the connection through the Server Explorer window.

In Server Explorer, click Connect to database . Then select the Microsoft SQL Server Database File (SqlClient) option and below select the .mdf file you want. Complete the steps required.

After you have added the database that will appear in Data Connections inside Server Explorer, right-click on the Data Connection and finally on Properties .

In the Properties window, there is a property called Connection String and this is the connection you need to use to access the database.

I recommend putting this connection in a Resource.

    
11.05.2018 / 12:32