Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I use LINQPad on MS Access data directly, or by passing args to a Web API Rest method?

I want to test out the LINQ in my Repository code:

public IEnumerable<InventoryItem> Get(string ID, string packSize, int CountToFetch)
{
    return inventoryItems.Where(i => 0 < String.Compare(i.Id, ID)).Where(i => 0 < String.Compare(i.PackSize.ToString(), packSize)).Take(CountToFetch);
}

...and am trying to use LINQPad to do that.

The data comes from an MS Access database; seeing that LINQPad doesn't seem to support Access "out of the box" that way, I wonder if either there's a driver for that (couldn't fine one - don't have the DevExpress product needed to use their driver), or if I could query by attaching to my Web API Rest method inside LINQPad?

I tried the SQL Server driver, hoping that would work for Access, too; I tried the WCF driver, hoping maybe that would work with Web API, but neither worked; with the latter attempt, I got, "XmlException: Data at the root level is invalid. Line 1, position 1."

like image 723
B. Clay Shannon-B. Crow Raven Avatar asked Nov 18 '13 22:11

B. Clay Shannon-B. Crow Raven


People also ask

Can MS Access connect to API?

How to import REST API data to Access. In MS Access, go to External Data Ribbon and select New Data Source and select From Other Sources and ODBC Database. Select the Source and destination of the data, select Import the source data into a new table in the current database and press OK.

Can you access an Access database from the Web?

All of your team can use your Microsoft Access database online from anywhere in the world using any computer or device. It feels just like you are working on your own computer, but you are actually running your Microsoft Access database online in a secure cloud.


2 Answers

There is a 'Microsoft Access Data Context Driver' for LinqPad

You can download it here: MSAccessDataContextDriver.lpx

View a screenshot here: LinqPad Northwind.accdb

UPDATE (5 Nov 2014) The driver now supports password protected MS Access databases

like image 61
Frank Avatar answered Sep 21 '22 17:09

Frank


Take a look at this LinqPad blog about how one person managed to connect and query MS Access.

how-to-connect-to-and-query-a-ms-access-database-mdb-and-accdb

One other possible solution is to use XPO persistent classes to connect to MS Access.

This topic describes how to install the driver and use it to query XPO persistent classes

LinqPad Data Context Drivers

There also might be a way to use the IQ Drivers. I am not sure if connections to MS Access have been added.

Hope this helps. Regards.

like image 22
SoftwareCarpenter Avatar answered Sep 24 '22 17:09

SoftwareCarpenter