Random Dev Notes

April 23, 2011

Accessing VFP data using LINQPad

Filed under: Development — Tags: , — Tom Brothers @ 10:52 am

A LINQ to VFP user recently suggested that I write a LINQPad provider that could be used to access VFP data.  This sounded like an interesting idea so I gave it a shot…

This blog entry provides a simple overview on how to use the driver.  The first thing you need to do is get the driver – which can be found in the LINQ to VFP download or as part of the NuGet download

Install the driver (must be x86 LINQPad build):

  1. Click “Add connection” link

  2. Click the “View more drivers…” button

  3. Click the “Browse…” button

  4. Open the LinqToVfpLinqPadDriver.lpx file

Connect to your database container (or free tables directory).

  1. If you just added the LinqToVfpLinqPadDriver you will continue to the “Choose Data Context” screen (otherwise you need to hit the “Add connection” link)
  2. Select the LINQ to VFP driver and then click the “Next >” button

  3. Enter a full connection string or click the “Locate Database Container…” link which will build a connection string for you. 

After installing the driver and setting up your connection you can start querying and manipulating your data.

Here is an example of a query.

You can also see the generated sql command.

Here is an example of manipulating the data.

* Cetin Basoz posted a video showing how to install the LINQPad driver.

Blog at WordPress.com.