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.