Attaching an MDF file to LocalDB

Question: I need to attach an MDF file to the LocalDB. How to do it? In this case, I lost the EPiServer LocalDB connection and hence could not publish my EPiServer 8 site properly to my test server. It failed with a database connection error – I tried to solve this issue by making changes to the target database server, not realizing that the problem was the LocalDB database on my laptop, trying to publish the EPiServer database to the target SQL Server.

How to do it:

In Visual Studio, go to Server Explorer => Data Connections => Add data connection

Attach MDF to LocalDB
Attach MDF to LocalDB

Browse / select the correct MDF file and give the database a friendly Logical Name.

Click OK, and there you go, you can find the attached database in the Server Explorer..

AttachMDFtoLocalDB-3

Advertisements

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s