Tales from the Evil Empire

Bertrand Le Roy's blog


Bertrand Le Roy

BoudinFatal's Gamercard

Tales from the Evil Empire - Blogged

Blogs I read

My other stuff


Using LinqPad to open SQL CE 4.0 databases

(c) Bertrand Le Roy 2010I love SQL CE 4.0 because it promises to solves a problem that only SQLite has been able to solve thus far: no-install, x-copy deployable relational engine with good performance.

The disadvantage in using such a recent engine is that tooling is only slowly coming together and is not there yet. I’ve been playing a little with LinqPad though and have noticed that SQL CE 4.0 was already supported. Here’s how to set it up.

Download and “install” LinqPad (the install is just unzipping the package wherever you want):


Once you’ve unzipped the package and double-clicked the executable, you should see the following screen:

Now click “Add Connection”. Switch to “Use a typed data context from your own assembly” and click “Entity Framework” then the “Next >” button:Choose data context

On the next screen, under “Data Context”, choose “Automatic”, and under “Provider” choose “SQL CE 4.0”.Connection paramatersFinally, click “Browse” next to “Attach database file” and choose your SQL CE .sdf file:Browse to your sdf file

Click “OK” and there you go: your SQL CE 4.0 database opens in LinqPad:Database opens in LinqPad

That was easy. But still, super-useful.

UPDATE: Sébastien Ros reminds me that there is a SQL Server Compact toolbox that integrates into VS and that you might want to try as well:


Bret Ferrier @runxc1 said:

Sweet now I can easily dig into the SQL CE DB that I have been using with Orchard.

# October 19, 2010 10:49 AM

Bertrand Le Roy said:

@Sean: I know about VistaDB. We haven't found its performance to be that good, but more importantly its licence is extremely unfriendly towards open-source.

# October 19, 2010 1:26 PM

Joe Albahari said:

Hi there

The combobox for choosing 'Automatic' is no longer there because it's redundant. It's exactly equivalent to choosing 'Build data context driver automatically' and choosing 'LINQ to SQL' in the first dialog. So if you do that (instead of choosing 'Entity Framework'), you'll be able to connect to SQL CE and run queries as before.


# March 14, 2011 9:08 AM

Test said:

Will LINQpad be updated to have built-in support for Entity Framework 4.1 (containg Code First)?

# April 14, 2011 5:42 AM

Bertrand Le Roy said:

@Test: you should ask the authors of LinqPad.

# April 14, 2011 3:18 PM