William Vaughn

Ah, what make you think that (serious) developers will have direct access to the base SQL Server .MDF file(s) In the Linq example (as shown below) you illustrate how to create a data source from a sql table by referencing the database file directly. This really assumes a great deal. It assumes the application has rights to the file, the database and the contents there-of. Most of my databases are stored on protected servers that don't expose the .mdf database files for direct access. Is LINQ a technology only for arrays or a SQL Express detached project database

' Create a data source from a SQL table.
Dim db As New DataContext("C:\Northwind\Northwnd.mdf")
Dim customers As Table(Of Customer) = db.GetTable(Of Customer)

Incidentally, this code does not compile. Intellisense said to use "DataObject" instead of DataContext and "DataTable" instead of Table.

Did I miss an Imports




Re: LINQ Project General Reference to specific .mdf?

Daniel Simmons - MSFT

This is about LINQ to SQL which is tracked in the LINQ forum. Moving there.




Re: LINQ Project General Reference to specific .mdf?

Fabrice MARGUERIE

I don't understand what you mean. It's great to be able to work the same way with a local database and a server database. For examples, it's much easier to reference a local file than having to setup a remote server prior to being able to run anything.





Re: LINQ Project General Reference to specific .mdf?

Matt Warren - MSFT

LINQ is for all those scenarios you mention and for accessing your protected database as well. However, its simply easier for everyone to distribute a working sample that queries against a SQL express database file. That way you can just run the sample app and see it work, without first bribing your DBA.

As for not compiling you need to import System.Linq and System.Data.Linq






Re: LINQ Project General Reference to specific .mdf?

Keith Farmer

Actually, there are shops out there using local databases -- especially Jet, but also Sql Express/MSDE. It's not just for examples, but production code. A few years back, I was working on medical imaging and analysis software that made extensive use of local Jet files and VBA.