views:

39

answers:

2

I am trying to add a database to the App_Data location in an ASP.NET MVC 2 application in Visual Studio 2008 (VS).

I have SQL Server 2005 Developer Edition installed on the local machine. However when adding the database VS complains that SQL Server 2005 Express is required. I configured VS to use the local server instance (MSSQLSERVER) which is the developer edition. It still failed.

I installed SQL Server 2005 Express on the machine and configured VS to use the Express server instance (SQLEXPRESS) and the database creation started working.

My questions is whether there is a way to get VS to use the developer edition of SQL Server.

A: 

If a database is to be installed in your app_Data directory, you need must use visual studio express.

If you want to use any other version of sql server, then the database pretty much has to go in the C:\Program Files\Microsoft SQL Server[instance name]\MSSQL\data directory and should be set up and managed using the normal sql server management studio tools.

Chris Lively
+2  A: 

Sure you can use the SQL Server 2005 Developer edition - you just cannot add the .mdf to App_data if you do this.

SQL Server 2005 Express has this extra feature that you can just simply drop a .mdf/.ldf in the App_Data folder and get going. But this is an Express-only feature.

If you want to use SQL Server 2005 Developer, you need to create a database on the server, using SQL Server Management Studio, and you need to connect to it using a regular connection string. The mdf/ldf files will be placed in the usual SQL Server data directory and used from there.

marc_s
It's counterintuitive in terms of the express edition having more features. Oh well, at least this answers it :)
Zaid Zawaideh