views:

2153

answers:

3

I have inherited a VB.net web app that I'm making some changes on. I'm perfectly capable with the programming side (VB and MSSQL) but I'm getting lost with the tools. I was given a zip file of the code and everything. I opened the sln file in Visual Studio 2005 and it worked fairly easily with little modification.

Running the app works perfectly. Problem is, I need to write some new SPs so need the database admin. SQL Server 2008 Express is installed but it doesn't see any database and I have no idea how to import it.

I have a folder App_Data in the project with the file ASPNETDB.MDF. Opening this in VS gived the error:

This server version is not supported. You must have Microsoft SQL Server 2005 Beta 2 or later.

Any ideas where to go from here?

+1  A: 

Visual Studio uses SMO 2005 to connec to to SQL. The SMO 2005 will not connect to SQL 2008 by design. You need to either upgrade VS to VS 2008, or downgrade Express to Express 2005.

Remus Rusanu
I think this offers a way to upgrade Visual Studio 2005 to connect to SQL Server 2008.http://msdn.microsoft.com/en-us/library/cc440724.aspx
Nathan
@Nathan: Good info, I wasn't aware they provided a fix for VS 2005 too. Nice.
Remus Rusanu
Thanks Remus. I just got around my "Server version not supported" issue by installing that CTP.
Nathan
+1  A: 

You need to get Sql Server Management Studio. From there you should be able to connect to the instance of Sql Server Express running on your system and tell it to attach to the .mdf file. This will allow you to use that database from withing sql server and management studio, and you will be able to add your stored procedure. Just remember to detach again when you're done, or you won't be able to use the mdf file as you expect from your app.

Joel Coehoorn
Thanks, "Attach" is what I wanted. Weird I couldn't find that from searching, I think my Google is getting worse...
DisgruntledGoat
+1  A: 

You can't attach mdf file made in SQL Server 2005 to a SQL Server 2008 instance. What you need is to install SQL Server 2005 Express, attach this file, backup database, then restore it on 2008 Server instance and detach the database. You will get properly created for 2008 Server mdf.

Ray