6/29/11

Microsoft LightSwitch – Clinic Sample SQLExpress Database Errors

If you are working on the Microsoft LightSwitch sample, and you have SQL Express 2005 or you do not have a SQL Express instance at all, you will face a couple of problems running the sample.

The first problem is that the sample was implemented with version of Microsoft SQL Express 2008. If you have the SQL Express 2005 version you will get the following incompatibility error:

The database cannot be opened because it is version 655. This server supports version 612 and earlier. A downgrade path is not supported.

To address this, you will need to upgrade that instance to SQL Express 2008. The latest at the time of this blog is the R2 version. Make sure to keep the SQLExpress instance name, otherwise you will face the next problem.

The LightSwitch sample projects have the SQL express instance name hardcoded in the project file. If you have a different instance name, and you try to update the data source to your instance name, you will soon discover that this does not work. When you compile the project you will continue to get the following error:

An error occurred while establishing a connection to SQL Server instance '.\SQLEXPRESS'

To address this error, you should edit the project file which has the extension lsproj and look for the property SqlExpressInstanceName. You should replace the SQLExpress instance name for the instance name from your environment.

Once you have made those changes, the sample application should run without a problem.

Hope it helps.

og-bit.com