如何使用 C# 应用程序查询 MS Access 数据库? [英] How to query MS Access database with C# application?

查看:46
本文介绍了如何使用 C# 应用程序查询 MS Access 数据库?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个应用程序,它使用 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.

这篇关于如何使用 C# 应用程序查询 MS Access 数据库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆