Monday, November 9, 2009

Failed to generate a user instance of SQL server due to a failure in starting the process for the user instance. The connection will be closed.

All though there can be more than one cause for this error, the simplest one can be this one which I'm about to tell you. When you want to add a connection using the server explorer of visual studio to a database created using SQL Server Management Studio 2008/2005, what you would normally do is Go to the Server Explorer > Right click and select Add Connection. It will look something like below image.

Then you will get a window like this.

You have to enter the server name or select from the drop down list. If you select one and click the Test Connection you will get this error.

What you should do is, enter the whole Server name like LOCALHOST\SQLEXPRESS (Default) or your own MYNAME\SQLEXPRESS. Don't just select from the drop down it only gives the computer name not the server name.