转载]ADO和DAO的区别

[转载]ADO和DAO的区别

ADO Compared with RDO and DAO
http://msdn.microsoft.com/en-us/library/aa261340(VS.60).aspx

ADO isn't automatically code-compatible with your existing data access applications. While ADO encapsulates the functionality of DAO and RDO, you must convert many of the language elements over to ADO syntax. In some cases, this will mean only a simple conversion of some functions of your existing code. In other cases, it might be best to rewrite the application using ADO's new features.
ADO不能自动适应已有的数据访问应用程序。虽然ADO封装了DAO和RDO的功能,但你还需要转换许多语言元素以适应ADO的语法。在大多数情况下,这意味着仅需要对你已有代码中的部分函数做一些简单的转换。

DAO (Data Access Objects) was the first object-oriented interface that exposed the Microsoft Jet database engine (used by Microsoft Access) and allowed Visual Basic developers to directly connect to Access tables - as well as other databases - through ODBC. DAO is suited best for either single-system applications or for small, local deployments.
DAO(数据访问对象)是Microsoft Jet数据库引擎(用于Microsoft Access)的第一个面向对象的接口,允许VB开发者直接链接到Access数据表,并且可以通过ODBC用于其他数据库。DAO是用于单个系统应用程序或小型的、局域网开发的最佳套件。

RDO (Remote Data Objects) is an object-oriented data access interface to ODBC combined with the easy-to-use style of DAO, providing an interface that exposes virtually all of ODBC’s low-level power and flexibility. RDO is limited, though, in that it doesn't access Jet or ISAM databases very well, and that it can access relational databases only through existing ODBC drivers. However, RDO has proven to be the interface of choice for a large number of SQL Server, Oracle, and other large relational database developers. RDO provides the objects, properties, and methods needed to access the more complex aspects of stored procedures and complex resultsets.
RDO(远程数据对象) 是一个面向对象的、通向ODBC的数据访问接口,结合DAO容易使用的风格,提供了一个接口,该接口暴露了ODBC几乎所有的底层能力及其灵活性。RDO是有限的,它不能很好的访问Jet或ISAM数据库,并且它只能通过已有的ODBC驱动来访问关系型数据库。然而,RDO已经被证明是大量SQL Server、Oracle及其他大型数据库开发者所选择的接口。RDO提供了访问面向复杂的存储过程,及复杂结果集所需要的对象、属性及方法。

ADO is the successor to DAO/RDO. Functionally ADO 2.0 is most similar to RDO, and there's generally a similar mapping between the two models. ADO "flattens" the object model used by DAO and RDO, meaning that it contains fewer objects and more properties, methods (and arguments), and events. For example, ADO has no equivalents to the rdoEngine and rdoEnvironment objects, which exposed the ODBC driver manager and hEnv interfaces. Nor can you currently create ODBC data sources from ADO, despite the fact that your interface might be through the ODBC OLE DB service provider.
ADO是DAO/RDO的继承者。ADO2.0提供的功能与RDO很相似, 并且在两个模型之间存在通用的相似的映射关系。ADO的“平面化”对象模型也被用于DAO和RDO,这意味着ADO包含更少的对象,及更多属性,方法(和参数),及事件。例如,ADO中没有与 rdoEngine 和rdoEnvironment 对象的等价物,来暴露ODBC驱动管理和hEnv接口。一般情况,你不能从ADO创建ODBC数据源,尽管实事上你的接口可能借助于ODBC OLE DB 服务提供者。

Much of the functionality contained in the DAO and RDO models was consolidated into single objects, making for a much simpler object model. Because of this, however, you might initially find it difficult to find the appropriate ADO object, collection, property, method, or event. Unlike DAO and RDO, although ADO objects are hierarchical, they are also creatable outside the scope of the hierarchy.
DAO和RDO所包含的许多功能被整理到单个对象中,以助于形成一个更简单的对象模型。因此,在一开始,你可能会发现找到适当的的ADO对象、集合、属性、方法或事件有点困难。不像DAO和RDO,虽然DAO对象也是层次化的,但它们也可以在层次范围外被创建。

It should be noted, however, that ADO currently doesn't support all of DAO's functionality. ADO mostly includes RDO-style functionality to interact with OLE DB data sources, plus remoting and DHTML technology.
需要注意的是,ADO现在还不支持所有的DAO功能。ADO主要包含了RDO风格的、与OLE DB数据源交互的功能,并附加远程和DHTML技术。

In general, it's probably too early in the evolution of ADO to migrate most DAO applications (except possibly ones using ODBCDirect) to ADO right now, since ADO doesn't currently support data definition (DDL), users, groups, and so forth. If you use DAO only for client-server applications and don't rely on the Jet database engine or use DDL, however, then you can probably migrate to ADO now. Eventually, Microsoft will provide an ADO DDL component to aid in DAO-to-ADO migration and provide generic DDL support for OLE DB providers.
一般情况下,对于大多数DAO应用程序(除了可能正在使用ODBC直连方式的那些程序)来说,现在就移到正处于发展阶段的ADO有点过早了,因为ADO现在不支持数据定义(DDL)、用户、组等等。如果你只在客户端应用程序中使DAO,并且不依赖于Jet数据库引擎,也不使用DDL,那么你现在就可以迁移到ADO了。事实上,微软将提供一个ADO DDL组件以帮助从DAO到ADO的迁移,并为OLE 数据库提供者提供通用DDL支持。
================================================
原文出自VB6的在线文档。VB6到现在有好多年了,现在ADO应该完善吧,微软还出了个ADO.net。现在正在学Access,弄不清ADO和DAO的关系,找来这篇文作参考。翻译为原创,转载请注明出处。

posted on 2012-12-30 20:58  ocr  阅读(1956)  评论(0编辑  收藏  举报