1
votes

Wonder if SQL Server 2008 R2 Express edition can be used with C# Express 2010? I'm getting the error below when trying to add 'Service-based Database' item to my projects.

Please note, I've only got SQL Server 2008 R2 Express.

Update 1 - I checked the service (MSSQLSERVER) and it's up and running, I've got no errors during SQL Server 2008 R2 installation either, the PC didn't have any previous versions of SQL Server installed.

The actual error:

Connections to SQL Server database files (.mdf) require SQL Server 2005 Express or SQL Server 2008 Express to be installed and running on the local computer. The current version of SQL Server Express can be downloaded at the following URL: http://go.microsoft.com/fwlink/?LinkId=125883

Thanks.

1
What does your connection string look like? Also: you're not consistent - you mention the Express edition in your title, yet in the question you talk about 2008 R2 (not mentioning anything about "Express"), and the service name also seems to point to a non-Express version that's installed. So is it Express or not?marc_s
@marc_s I simply don't have a connection string as I don't have the actual database, I was hoping to create it in VS2010 Express.user1514042
Refer this and this.. Attaching to a database via AttachDBFilename is only possible when you use one of the Express editions of the product. So it won't work on the developer edition. Since user instances will be removed in a future version of SQL Server, you probably shouldn't use this.Niranjan Singh

1 Answers

0
votes

As the message says, Visual C# Express 2010 does not support connections to SQL Server 2008 R2 Express (which is not an upgrade to SQL Server 2008 Express). You could give Visual Studio 2012 a try.

EDIT: It seems like my above statement is not correct. I've tested it and I got SQL Server 2008 R2 Express working with Visual Studio 2010 Premium. So I guess it should also work in Visual C# Express 2010.

In order for it to work I had to change 'SQL Server Instance Name' found in the options under 'Database Tools' --> 'Data Connections'. The default value is SQLEXPRESS but I changed my instance name to SQLEXPRESS2008R2 during installation.