views:

5567

answers:

6

I'm trying some of the ASP.NET MVC tutorials and one of them has the following steps:

  • Right-click on the "App_Data" folder, and choose "Add New item"
  • Choose "SQL Server Database" under the "Data" category.

However, once I do that, I get the following message from Visual Studio:

Connections to SQL Server files (*.mdf) require SQL Server Express 2005 to function proprely. Please verify the installation of the component or download from the URL...

The thing is that I have SQL Server 2008 Developer Edition installed, and I would really rather not install any Express versions (2005 or 2008) if I don't have to. Is there a work-around for this issue?

+4  A: 

Actually SQL express is a whole different database engine then SQL Server 2005. So yes if you want to use mdf files you'd need SQL Express.

masfenix
Oh, so that means I'll have to use the normal approach of creating a separate database and referencing it in the project rather than what the tutorials suggest. Thanks :)
Jedidja
That's very misleading statement. SQL Express and the full SQL Server product actually do share the very same database engine (and virtually everything else). The reason why the full server doesn't support user instance databases is beyond me, but it was most likely either a business decision or one routed in security. Implementation-wise, all the bits are there.
Euro Micelli
Actually they are not the same (hence the differences). The sort and optimizers are different, multi cpu usage, memory allocation routines, lots of changes. They may be FUNCTIONALLY the same, but are quite different under the hood. The reason the probably don't support them is they perform terribly. It is not a best practice to use them in anything short of demos. File based connections are quite a bit slower.
Jason Short
+7  A: 

To illuminate masfenix's reply, SQL Express supports one feature that is not supported by full-blown SQL Server: a "user instance" database. With SQL Express installed and an mdf file in your App_Data folder, the application will dynamically attach and detach it as needed. For hobbyist or small business sites, this may be perfect. If you're running SQL elsewhere in the enterprise, you probably don't want to go this route and therefore the feature isn't useful to you.

GalacticCowboy
Thanks for the clarification :)
Jedidja
+2  A: 

I want to point out that I have both Developer edition and Express edition installed. And I still run into the same error. I think Express edition must be installed as a single instance.

Ken Yao
You should make sure that Visual Studio knows about your instance of SQL Server. Go to Visual Studion -> Tools -> Database Tools -> Data Connections -> [Instance Name]. Make sure it lists the correct instance name for your SQL Express (usually "SQLEXPRESS").
Euro Micelli
+1  A: 

I have the same problem but I've sql 2008 express installed. any way to make it work with sql 2008 express so I don't have to install the 4th sql instance on my machine?? I already have sql 2005, sql 2008, sql 2008 express

what the F... :)

smnbss
You should make sure that Visual Studio knows about your instance of SQL Server. Go to Visual Studion -> Tools -> Database Tools -> Data Connections -> [Instance Name]. Make sure it lists the correct instance name for your SQL Express (usually "SQLEXPRESS").
Euro Micelli
Why not just create a database in one of the other 3 instances you have installed and use it? Why bother with a file based connection at all?
Jason Short
+11  A: 

I ran into this problem too on 64-bit Windows 7 (using 64-bit SQL Server Express 2008).

There are two methods of fixing this problem referenced in the Microsoft Support Knowledge Base article:

1. Workaround

To work around this problem, uninstall the 64-bit version of SQL Server Express 2008, and then install the 32-bit version of SQL Server Express 2008.

If you don't want to do the uninstall/install, then try the Hotfix method below.

2. Hotfix

A supported hotfix is now available from Microsoft. However, it is intended to correct only the problem that this article describes. Apply it only to systems that are experiencing this specific problem.

Although the article itself doesn't include a link to the hotfix, you can get it here: http://support.microsoft.com/hotfix/KBHotfix.aspx?kbnum=957944

Ken
+1 This resolved my issue working on a 64-bit platform.
dlux
A: 

Thank you for the solution, Ken! I have been fighting to get SQL Server 2008 installed properly on 7 x64 for the last couple days and this is the last piece of the puzzle. Google led me to this page and you certainly helped a lot!.

Blu Dragon
Great, glad it worked out, Joe!
Ken
The only problem now is that when I try to install a program that uses an .mdf file, the installer complains that it cannot find SQL Server 2005 - same error message that I was getting in VS. Any fix for that? Maybe I'll have to create a custom installer...
Blu Dragon
I just discovered that if you go into the project properties, you can disable the "SQL Server 2005 Express" requirement. I'm not sure if this is a good idea, though, and I am afraid that it will break my program. I need to do more testing to see what happens.
Blu Dragon
Some Google-ing(sp?) has taken me to <a href="http://blogs.msdn.com/sqlexpress/archive/2008/09/12/faq-installing-the-sql-server-2008-express-clickonce-bootstrapper-for-visual-studio-2008-sp1.aspx">this article</a> which seems like it has a solution.
Blu Dragon