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):

http://www.linqpad.net/

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:
http://saraford.net/2010/09/21/sql-server-compact-toolbox-extension-12/

4 Comments

Comments have been disabled for this content.