ADO在MICROSOFT DATA ACCESS 中的角色

什么是ADO,ADO和OLE DB、ODBC到底是什么关系,本人在查找MSDN时找到本文,内容虽然比较简单,但比较清晰,第一次翻译,错误之处请大家多多指正。

The Role of ADO in Microsoft Data Access

ADO在MICROSOFT DATA ACCESS 中的角色

The Microsoft Data Access Components (MDAC) provide data access that is independent of data stores, tools, and languages. It provides a high-level, easy-to-use interface, and a low-level, high-performance interface to practically any data store available. You can use this flexibility to integrate diverse data stores and use your choice of tools, applications, and platform services to create the right solutions for your needs. These technologies provide the basic framework for general-purpose data access in Microsoft? Windows? operating systems.

MDAC提供独立于数据源、工具和语言的数据访问。它提供了一个高级、简单的接口和一个低级但高效的接口来访问几乎所有可用的数据源。你可以用它提供的灵活性来整合不同的数据源并结合你选择的工具、应用程序和平台服务来为你的需求建立正确的解决方案。这些技术提供了一个基于WINDOWS操作系统的面向多用途的数据访问框架。


There are three primary technologies in MDAC. ActiveX Data Objects (ADO) is a high-level, easy-to-use interface to OLE DB.OLE DB is a low-level, high-performance interface to a variety of data stores. ADO and OLE DB both can work with relational(tabular) and nonrelational (hierarchical or stream) data. Finally, Open Database Connectivity (ODBC) is another low-level, high-performance interface that is designed specifically for relational data stores.

在MDAC中主要有三种技术,ADO提供了面向OLE DB的高级,简单的接口。OLE DB提供了面向不同数据源的低级但高效的接口。ADO和OLE DB都可以访问关系型(如表)和非关系型(层次或流)的数据。最后,ODBC是另一种被设计成专门面向关系型数据的低级但高效的接口。

ADO provides a layer of abstraction between your client or middle-tier application and the low-level OLE DB interfaces. ADOuses a small set of Automation objects to provide a simple and efficient interface to OLE DB. This interface makes ADO the perfect choice for developers in higher level languages, such as Visual Basic and even VBScript, who want to access datawithout having to learn the intricacies of COM and OLE DB.

ADO 在你的客户端或中间层应用程序和低级的OLE DB 接口之间提供了一个抽象层。ADO 利用一个小的自动化对象集来提供一个简单而有效的访问OLE DB的接口。这个接口使ADO成为高级语言使用者的首选,例如VISUAL BASIC和VBSCRIPT,使用者不需要通过学习复杂的COM和OLE DB知识来访问数据。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
要使用MFC修改Access的数据,您需要使用ADO(ActiveX Data Objects)来连接到Access数据库并执行查询。以下是一些基本步骤: 1. 在Visual Studio创建一个MFC应用程序项目。 2. 在项目添加一个数据源(Data Source),选择Microsoft Access作为数据源类型,并选择要连接的Access数据库文件。 3. 将ADO头文件添加到您的StdAfx.h文件,这样您就可以使用ADO对象。 4. 在您的代码创建一个ADO连接对象,并打开连接: ``` _ConnectionPtr pConnection; HRESULT hr = pConnection.CreateInstance(__uuidof(Connection)); if (SUCCEEDED(hr)) { CString strConn; strConn.Format(_T("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=%s;Persist Security Info=False;"), strDatabasePath); hr = pConnection->Open((_bstr_t)strConn, "", "", adConnectUnspecified); } ``` 5. 创建一个ADO命令对象,设置其类型为adCmdText,并设置其CommandText属性为您要执行的查询。例如,以下代码将更新名为“Customers”的表的“CustomerName”列: ``` _CommandPtr pCmd; HRESULT hr = pCmd.CreateInstance(__uuidof(Command)); if (SUCCEEDED(hr)) { CString strSQL; strSQL.Format(_T("UPDATE Customers SET CustomerName = '%s' WHERE CustomerID = %d"), strNewName, nCustomerID); pCmd->ActiveConnection = pConnection; pCmd->CommandType = adCmdText; pCmd->CommandText = (_bstr_t)strSQL; pCmd->Execute(NULL, NULL, adCmdText); } ``` 6. 最后,关闭连接并清理所有对象: ``` if (pCmd != NULL) { pCmd->Release(); } if (pConnection != NULL) { pConnection->Close(); pConnection->Release(); } ``` 请注意,这只是一个基本的示例,您需要根据您的具体需求进行修改。您还需要处理连接和查询的错误,并确保您的应用程序在处理敏感数据时具有适当的安全性。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

netscaler

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值