In my case, I wanted SQLEXPRESS, not LocalDB, because I wanted to run full IIS, not the development server. One answer returned to LocalDB, but I could not do it.
On the first attempt, "Show table data" failed. But I did "Show table data" by changing the new SQLEXPRESS connection string created by VS2012. I removed AttachDbFilename = | DataDirectory | and User instance = True from the new connection string.
Show table data:
<add name="DefaultConnection" connectionString="Data Source=instance\SQLEXPRESS;AttachDbFilename=|DataDirectory|\aspnet-mydb-20131028231936.mdf;Initial Catalog=aspnet-mydb-20131028231936;Integrated Security=True;User Instance=True" providerName="System.Data.SqlClient" />
Show table data:
<add name="DefaultConnection" connectionString="Data Source=instance\SQLEXPRESS;Initial Catalog=aspnet-mydb-20131028231936;Integrated Security=True;" providerName="System.Data.SqlClient" />
One more note. In my case, SQLEXPRESS is a named instance, as you can see that the data source is in the connection string.
source share