views:

1366

answers:

1

After upgrading my Visual C# 2008 Express Edition to .NET3.5, SP1, I've been unable to create new LINQ to SQL classes using a remotely connected database. I used to be able to do so fine.

I open up a project (windows forms, class library, same behavior), and either use the New -> Linq To SQL classes method or go directly for adding the Data Connection I will need later, i.e. opening the Database Explorer and right-clicking Data Connections for "Add Connection."

This leaves me with only 3 choices however, MS Access Database Fiel, SQL Server Compact 3.5 (which says it's a db file as well in the description) and Microsoft SQL Server Database File.

What am I missing when I expect there to be a way to connect to f.ex. a SQL Server 2005/2008 on my network, or via the internet?

Thanks,

+1  A: 

You can't connect to a SQL server using the express versions of VS but what you can do is use a tool called sqlMetal.exe to generate a dbml from your SQL server, then you can just add that dbml to you project and pass the connection string to the datacontext that it generates.

To use Open Visual Studio command line and type "Sqlmetal" and it will show you how to use it, more information can be found here.

The only problem is that you can't drag n drop tables into the dbml once its generated as you can't connect to the server in the database explorer.

Nathan W
Perfect, thank you!
ulrikj