我查了一下MSDN,摘录如下:OLE DB Providers
Four OLE DB providers are included with this version of OLE DB. OLE DB Provider for Oracle
 Allows high performance and functional access to Oracle data for Visual Basic® applications. OLE DB Provider for ODBC Provides
 access to ODBC data sources by exposing OLE DB interfaces, methods and properties with certain limitations. OLE DB Provider for Microsoft® Jet
 Allows Microsoft Jet-specific implementation of standard OLE DB interfaces, methods, and properties. OLE DB provider for Microsoft® SQL Server™
 Exposes interfaces to consumers wanting access to data on one or more SQL Servers. ADO是用OLEDB连接的,ODBC又是OLEDB中的一种,为什么很多人说用ADO不用ODBC,或者问用ADO好还是用ODBC好?我弄不懂了?到底是怎么回事?是不是我的MSDN太旧了?

解决方案 »

  1.   

    ADO比ODBC高级,封装得更完整,是以COM为基础的,而ODBC是以API为基础的。
    为了使ADO能兼容更多范围的数据源特别是没有ADO驱动但有ODBC驱动的数据源,ADO也提供了通过ODBC访问数据源的途径。
      

  2.   

    MSDN上说OLE DB都是基于COM的。是不是我的MSDN太旧了?
      

  3.   

    OLE DB都是基于COM的,没错
      

  4.   

    to dejoy(燕青):不用OLE DB Provider for ODBC Provides,怎样用DDBC直接连数据库?
      

  5.   

    OLE DB and ODBC are application programming interfaces (APIs) designed to provide access to a wide range of data sources. A data source consists of the data, its associated database management system (DBMS), the platform on which the DBMS exists, and the network used to access that platform. ODBC is designed to provide access primarily to SQL data in a multiplatform environment. OLE DB is designed to provide access to all types of data in an OLE Component Object Model (COM) environment. OLE DB includes the SQL functionality defined in ODBC but also defines interfaces suitable for gaining access to data other than SQL data.这两段话什么意思?
      

  6.   

    ODBC是通用的,通过ODBC,ADO能存取任何ODBC支持的数据,如OLE DB Provider for ODBC Provides。
    有原生的针对某一种数据库的ADO驱动提供程序,而不用经过ODBC,如OLE DB Provider for Oracle,OLE DB Provider for SQL Server等。
      

  7.   

    to dejoy(燕青):说得对。但OLE DB专用程序只提供了对大型数据库Oracle,sql Server的支持。像DB2,Informix能只能通过ODBC。通用性要差一点。用专用的OLE DB驱动要比ODBC快,但移植性要差一点。假如从SQL Server2000要升级到SQL Server3000(假设)的话,必须改程序中的连接字符串。若用DDBC的DSN方式的话,则不需要改程序,直接改DSN好了。(用非DSN方式的ODBC也要改程序)。但是用DSN的话,每台机都要设一个DSN又太麻烦。OLE DB只是一个接口,一个与数据库通讯的接口,可以连接专用数据库和DDBC。ADO通过OLE DB接口来访问数据。我仍然坚持'用ADO不用ODBC’或者'用ADO好还是用ODBC好?'这样的话是不对的.
      

  8.   

    zxkid() 呵呵 你说的也有理啊,只提供了Oracle,sql Server的支持的程序是微软写的,一个世界第一的数据库系统,一个是自己的系统,你说他能不写吗?至于其他的嘛嘿嘿……
    其实其它的数据库也应该有OLE DB驱动程序,只不过是厂家自己写罢了,这类程序一般也是免费提供的,你可以到他们的网上看看,也有第三方公司写的,不过好像要收费。
    “用专用的OLE DB驱动要比ODBC快,但移植性要差一点”这句话就不对了,ADO也有连接字符串的配制文件,只不过不叫DSN,而是叫UDL(Microsoft 数据链接文件),所以“假如从SQL Server2000要升级到SQL Server3000(假设)的话,必须改程序中的连接字符串”这样的顾虑是没有必要的。