开发者

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

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 nume开发者_JAVA百科rous 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.


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


I assume you're using the AttachDBFileName=|DataDirectory|YourFile.mdf style of connecting to your SQL Server Express database, right??

The option of attaching a *.mdf file using AttachDBFile will only work with SQL Server Express - either in 2005 or 2008 versions. It's specifically an Express-only feature.

It does not work with the full versions (developer edition, web edition, standard edition, enterprise edition), and there is no switch or config or anything to enable that.

So if you actually want to use an attached .mdf file, you must use SQL Server Express - no way around that.

But if you already have a full version (non-Express version) of SQL Server installed - why not just install your database on that server, and use it from there?

Marc


The error shows that there is nothing wrong with Visual Studio 2008. The database files you are trying to connect to are made in SQL Server 2005, are some how configured to run with SQL Server 2005 only.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜