views:

36

answers:

0

I'm using Visual Studio 2010 RTM. I want to do model-first, so I started a new MVC app and added a new blank edmx. Created a few entities. No problem. Then I "Generate Database from Model", and allow the dialog to create a new database for me, which it does successfully as 'mydatabase.mdf' in the app's App_Data directory.

Then I open the generated sql file (in Visual Studio). To run it of course I have to give it a connection. I am not sure if it's right, but I used '.\SQLEXPRESS' and Windows authentication. No idea how I'd tell it where the MDF is.

Then the problem -- upon executing it, I get:

Msg 911, Level 16, State 1, Line 1 Could not locate entry in sysdatabases for database 'mydatabase'. No entry found with that name. Make sure that the name is entered correctly.

And indeed there were no tables created in the MDF.

So... what am I doing wrong, or am I off my rocker expecting this to work? :)