如何查询使用C#应用程序的MS Access数据库?应用程序、数据库、MS、Access

2023-09-07 10:02:05 作者:稚

我有一个使用的Microsoft.Office.Interop.Excel 从Excel工作簿中获取数据的应用程序。在Excel工作簿中的信息已被移动到一个Access数据库,我一直在负责更新应用程序,因此,它会寻找在数据库中的数据。我发现 Microsoft.Office.Interop.Access 的参考,但我怎么用它来打开数据库并运行查询? MSDN上关于这个文件似乎有所欠缺。也许我找错了地方...:\在C#应用程序使用.NET 3.5。谢谢你。

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.

推荐答案

我不打算重复的一切,是在MSDN,有过一个伟大的步行路程,就在这里:的 http://msdn.microsoft.com/en-us/library/ms971485.aspx

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

不过,千万注意,你不需要使用互操作程序集,它们是异常缓慢,很难使用,也只是一个PIA一般。

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.

由于MSDN文章显示,你想做什么都可以使用ADO.NET来完成。

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