Wednesday, November 27, 2013

MS Access in LinqPad

Once in a while a legacy MS Access database passes my way. And for some reason these databases have made themselves indispensable and can not be ignored. Most of the time they provide in some core business data and I am being asked to extend reports or even extend the datamodel and application.

Being very used to c# and linq/lambda and a huge fan of Joseph Albahari's LinqPad I missed a connection between the legacy MS Access databases and the beautiful new query language Microsoft introduced back in 2007.

Luckily LinqPad provides a way to create custom drivers. So I made one for MS Access, so it is now possible to use Linq on the MS Access database (*.mdb, *.accdb). See the screenshots below:



I was inspired by the IQ Driver of Joseph, which used the IQ Toolkit. Based on the Access implementation of the IQ Toolkit I was able to write MS Access driver for LinqPad.

The driver can be downloaded here: MSAccessDataContextDriver.lpx

UPDATE (5 Nov 2014): The driver now supports password protected MS Access files.