2

I am trying to add a SQL Server data source to a C# console app.

When I try and add a new connection to my .dbml file the only Data Source available is Microsoft SQL Server Database File (sqlclient) whereas I need Microsoft SQL Server (sqlclient).

The change button is grayed out, so I can't change it.

enter image description here

How do I change this?

(I wondered if it was a bug, so tried uninstalling/reinstalling Visual Studio - but still no joy.)

John Saunders
  • 160,644
  • 26
  • 247
  • 397
Ben
  • 4,281
  • 8
  • 62
  • 103
  • 1
    Not a bug, it's a limitation on Express Version of the IDE. Mitchel Sellers answered there and he also gives the workaround. (Changing the connection string manually). – Ernesto Oct 26 '11 at 22:27

2 Answers2

2

This is actually a limitation of the Express product and you can get around it with a modification of your SQL Server connection string manually. For more information have a look at this SO Post.

Community
  • 1
  • 1
Mitchel Sellers
  • 62,228
  • 14
  • 110
  • 173
  • Could you add the relevant workaround to this question? The other one was closed and will eventually be deleted. – user7116 Oct 26 '11 at 22:58
1

I got this working by using the workaround from the post above:

Workaround:

1.Open your solution in Visual Web Developer Express. It will not load some of the projects in the solution but it is ok.

2.Make a new connection in Database Explorer to the required database from SQL Server.

3.Add a new class library project.

4.Add a LINQ to SQL Classes item and link it to your database.

5.Close the solution.

6.Open the solution in Visual C# Express.

Now you have a LINQ to SQL classes library that is linked to your SQL Server database in Visual C# Express.

Ben
  • 4,281
  • 8
  • 62
  • 103