I am looking to understand how to use Database files with ASP.Net web application projects. Very similar questions were posted, but I couldn't find quite the clarification I am looking for, so here's another post.
I've been programming with ASP.Net for a while, but have always been in an environment where I had a full SQL server setup, and the databases were not file format. For the purposes of this project I am trying to keep it in .MDF format so that I can pass
it on easily to my customer and let them do what they wish with it.
The project is in Visual Studio 2010, a simple ASP.Net 4.0 MVC2 application that is to use EF 4.0 for persistence.
First thing I did was add a database to App_Data folder. It shows up on Server Explorer and I can manually add tables via Visual Studio - this should mean that the connection string and permissions and such fine I would think. So, next step.
I created an Entity Diagram, built everything "model first" and used the Model to generate the database schema. Using the connection string in web.config, the generated SQL code runs, and says at the bottom of VS, "Disconnected".
I go to the Server Explorer, and sure enough there's a red X next to the DB file. I expand the MDF, the little black arrow comes back, showing me I am connected. I try to run it again... and it does the same... "Disconnected"
View Complete Post