Monday, 9 July 2012

Opening a SQL Server 2012 database in Visual Studio 2010

After installing SQL Server Express 2012 and using the SQL Server Management Studio to create a database, I found that I couldn't integrate SQL Express 2012 into the Visual Studio Server Explorer in a way that VS listed all my 2012 databases. VS would show databases from an earlier 2008 SQL Server I had installed on my PC but not the 2012 version.

The only way I could show the DB was to add a connection to a database file. To do this I had to:-

1. Right-click the Data Connections node in Server Explorer and choose Add Connection...

2. Make sure the Data Source field was set to SQL Server Client as shown in this pic.:




3. Then in Server name field type in the name of the new SQL Server Express 2012 instance. In the pic. above, the name of my server is SLIQSQL but for a default installation of SQL Server Express, the server name is likely to be SQLEXPRESS (I just chose a different name during the installation process).

4. Then press the Test Connection button. If all is well you should get a Connection Succeeded message.

5. Finally, choose the database you want to add in the Select or enter a database name field and press OK to close the dialog.

The chosen database should now show in the Server Explorer.

No comments: