VSTS issues adding a new SQL Database (MDF file) for web testing

I had an interesting problem yesterday while working on creating some coded data driven web tests in VSTS. My developer PC has SQL Server 2005 installed and Visual Studio Team Suite. I was considering creating the test data in my local SQL Server database but then figured it would make more sense to create an MDF file inside the project. This would allow the database to be easily versioned in TFS (data is read only) and allow others in the team to easily run the data driven web tests as well without needing to run SQL scripts on their PC to create the tables and populate them with the sample data.

When I attempted to add the MDF file by right clicking in the project, Add New Item.. SQL Database, I received the following message;

“Connections to SQL Server files (*.mdf) require SQL Server Express 2005 to function properly. Please verify the installation of the component or download from the URL: http://go.microsoft.com/fwlink/?linkId=49251

I dutifully installed SQL Server 2005 Express edition and applied service pack 1 to it for good measure. When I tried to add the SQL Database item to the project I again received the same error message.

It is at this point that I remind readers that I am certainly no SQL expert and in fact I’m not over savvy in all things SQL at all [:$]

The fix I found was to go VS2005 into “Tools Options Database Tools Data Connections” and in the Connection Options there’s a textbox labeled “SQL Server Instance Name (blank for default):”. When I entered SQLEXPRESS into this field, I was able to then start adding MDF files to my project.

I have not managed to find very much information on this and cannot guarantee this will not break anything else but in the mean time I am happily data driving my web tests and things are all OK.

Can anyone provide an insight into exactly what this field does in VS2005? Any know problems having SQL Express and SQL Server 2005 on the same box?

[UPDATE]

Peter Jones (http://www.jonesie.net.nz) provided the following information in answer to my questions above. He also pointed out that my blog’s “comments” feature is broken still [:@]. Looks like I might need to upgrade to the latest CS version…

Here’s Peter’s helpful response;

You can install multiple instances of SQL Server (2k, 05, Express or otherwise) on the same machine.  Each instance has a name that is specified during install.  You can also have 1 default instance.

By default, VS installs SQL Express with an instance called SQLEXPRESS.  For the database connection thing to work in VS it needs to know the name of the instance.  From the server explorer you can create a connection to any database and you get the oppurtunity to specify the server name and instance.

I’m guessing it was blank in your setup becuase you explicity chose not to install SQL Express when you installed VS.