Sql – Visual Studio 2008 adding SQL Server database (SQL Server 2008 Management Studio) not working

database connectionsql-server-2008visual-studio-2008

I'm trying to practice using the ASP.NET MVC at home, but I ran into an impossible problem. I cannot open a connection to SQL Server 2008, I get this error: "Connections to SQL Server files (*.mdf) require SQL Server Express 2005 to function properly. …"

I've googled around for numerous responses, none of them either working or addressing this issue. I'm running Vista 32-bit, my SQL Server 2008 Management Studio is also 32-bit, I have SP1 installed both on Visual Studio 2008 Professional, as well as the SQL Server. I changed the machine.config connectionStrings from ./SQLExpress to my SQL Server 2008 name.

Now if I connect manually through web.config, in an asp:datasource or code-behind, everything works fine. But for some reason trying to add a database Connection directly like this always gets the error. This is pretty fatal, since I can't rightly do much unless I can use LINQ to SQL with my MVC test project, and this is the only way I know how. Worked fine in school and work, but not at home.

Installing SQL Server Express 2005, as some have suggested, is not an option. Obviously it HAS to work with SQL Server 2008.

Best Answer

If your web app can talk to the database correctly, the problem isn't with the sql server or with your connection string, operating system, or what have you.

Make sure that SQL Management Studio is pointed at the correct instance of SQL Server Express on your box: see this thread on msdn social