Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to query MS Access database with C# application?

I have an application that uses Microsoft.Office.Interop.Excel to pull data from an Excel workbook. The information in the Excel workbook has been moved to an Access database, and I have been tasked to update the application, so that it will look for the data in the database. I found the Microsoft.Office.Interop.Access reference, but how do I use it to open the database and run queries? The documentation on this on MSDN seems to be somewhat lacking. Maybe I'm looking in the wrong place... :\ The C# application uses .NET 3.5. Thanks.

like image 312
Jim Fell Avatar asked Feb 23 '23 13:02

Jim Fell


1 Answers

I'm not going to repeat everything that's in the MSDN, there's a great walk through right here: http://msdn.microsoft.com/en-us/library/ms971485.aspx

However, do note that you don't need to use the interop assemblies, they are horribly slow, difficult to use and well just a PIA in general.

As the MSDN article shows, everything you want to do can be done using ADO.NET.

like image 156
shawty Avatar answered Feb 25 '23 02:02

shawty