I am following the Mvc4 OdeToFood tutorial on Pluralsight, which uses asp-net Mvc4 and visual studio express for web 2012.
I am trying to set up a small local database to hold some information so that I can proceed with the tutorial, but I am having trouble getting the database versions and connection string right, I have never done anything like this before.
I have been going fine until a few days ago when I tried to connect to a Local database.
Unlike in the tutorial, In my web.config file I had no connection string tags, The v11.0 database instance was specified in the tutorial, which from google seems to be a local database used for development purposes. so I looked up what I needed and entered into the Web.config file:
<connectionStrings>
<add name="DefaultConnection" connectionString="Data Source=
(LocalDb)\v11.0;Initial
Catalog=OdeToFoodDb;Integrated
Security=SSPI;AttachDBFilename=|DataDirectory|\OdeToFoodDb.mdf"
providerName="System.Data.SqlClient" />
</connectionStrings>
This would not work for me, so upon more googling I tried:
<connectionStrings>
<add name="OdeToFood" connectionString="Data Source=
(LocalDb)\MSSQLLocalDB;Initial
Catalog=aspnet-OdeToFood;Integrated
Security=SSPI;AttachDBFilename=|DataDirectory|\OdeToFood.mdf"
providerName="System.Data.SqlClient" />
</connectionStrings>
This initially did work, but when I tried to modify the tables, there was a database version error and I could not use the database crud functionality with the program. I searched as to why this wouldn't work and looked through the error files and I found that once you change a .mdf file to v13.0 (from googling I believe MSSQLLocalDB is v13.0) it cannot be reverted to a v11.0 .mdf version. So I guess vs express 2012 can only use v11.0?
If anyone can help me or point me to somewhere where I can learn how to connect to this database I would be really grateful.