Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

asp.net mvc Invalid value for key 'attachdbfilename'

I am currently reading Manning's "ASP.NET MVC 4 in Action" book and trying to get the first example to work.

Within my test application, I built a simple Model and created some Views. I then imported "SQL Server Compact" using NuGet.

When I finally try to run the application I get the following error:

Invalid value for key 'attachdbfilename'

This occurs on every interaction with the Database (SELECT or other CRUD operations) I am running. Any ideas?

like image 667
Bick Avatar asked Aug 27 '12 00:08

Bick


2 Answers

Though, I am bit late to respond to this question but I was facing the same issue and I resolved it by modifying the connection string like below

 <add name="MovieDBContext"
    connectionString="Data Source=.;Initial Catalog=Movies;AttachDbFilename=|DataDirectory|\Movies.mdf;Integrated Security=True"
    providerName="System.Data.SqlClient" />

Hope this would be helpful for others too.

like image 104
Zerotoinfinity Avatar answered Oct 24 '22 16:10

Zerotoinfinity


I tried finding a solution for this particular error without success.

Fixed it in the end by updating the .Net Framework 4 to 4.0.2. Patch and details can be found Here is the link

Hope it helps

like image 28
Teto Avatar answered Oct 24 '22 16:10

Teto