A
a a r o n . k e m p f
http://msdn.microsoft.com/en-us/library/aa293439(VS.60).aspx
Further, DAO 3.x is not thread-safe. You should use DAO only in the
primary thread of an application.
http://msdn.microsoft.com/en-us/library/yb6xfda3.aspx
.NET, the Visual C++ environment and wizards no longer support DAO
(although the DAO classes are included and you can still use them)
http://support.microsoft.com/kb/325020
SUMMARY
This article points to the "Migrating from DAO and ODBCDirect to ADO"
white paper.
MORE INFORMATION
This white paper provides a migration path for users who want to use
ADO instead of Data Access Objects (DAO) and ODBCDirect to access SQL
Server or the Microsoft Data Engine (MSDE). The white paper briefly
describes ADO components and DAO and ODBCDirect components, and
compares the object models of these two technologies. It maps the
methods and properties of DAO and ODBCDirect to the methods of ADO,
and provides a guide for revising application code that uses DAO and
ODBCDirect technology to upgrade to ADO technology to connect to SQL
Server and MSDE database engines.
Data Access Objects (DAO) 3.5 technology provides two paths to access
Open Database Connectivity (ODBC) data sources. The first is through
the JET database engine,
which is not the most efficient way to deal with intelligent database
engines such as Microsoft® SQL Server™.
which is not the most efficient way to deal with intelligent database
engines such as Microsoft® SQL Server™.
which is not the most efficient way to deal with intelligent database
engines such as Microsoft® SQL Server™.
ODBCDirect is the second path that bypasses the JET database engine,
and provides direct access to the server by connecting through ODBC
application programming interface (API).
DAO permits users to consume only JET and ODBC data sources; however,
ADO provides a lot of flexibility to users to consume all OLE DB data
sources. As long as you have Microsoft OLE DB provider as a data
source, ADO connects and communicates with the server. Microsoft
provides several OLE DB providers through Microsoft Data Access
Components (MDAC) including OLE DB Provider for ODBC Drivers and OLE
DB Provider for SQL Server (SQLOLEDB). For additional information
about MDAC, visit the following Microsoft Web site:
http://www.microsoft.com/data/
You can also develop your own OLE DB providers for proprietary data
sources. ADO is designed to access and to work with data in a
relational database server and other non-relational data stores
through OLE DB providers.
ADO provides the following two methods to access a SQL Server
database:
The preferred method, is to use OLE DB Provider for SQL Server to
connect to the database from ADO. With this method, SQL Server exposes
significant native functionality that is based on the native OLE DB
Provider for SQL Server and provides users with faster and better
access.
Provider=MSDASQL.1;Persist Security Info=False;Data
Source=mytestDsn;Initial Catalog=Northwind
Notice the keyword Provider in the connection string. MSDASQL is not a
SQL Server Provider. It is an OLE DB Provider for ODBC DriversObject
Models.
The second method is to use OLE DB Provider for ODBC Drivers to
connect to the database. This method uses the SQL Server ODBC Driver.
The connection string looks similar to the following:
Moreover, ADO object model has fewer objects, but has more properties,
methods, and method arguments than DAO and ODBCDirect. ADO is thread-
safe, but DAO is not. Therefore, do not use DAO in Active Server Pages
(ASP) pages or in multithreaded applications.
Unlike DAO and ODBCDirect object model, ADO is less hierarchical, as
shown in Figure 2. You can create most of the objects in ADO without
calling a function on another object to generate the objects.
http://www.microsoft.com/communitie...22-9b64-fb19a01ffe88&cat=&lang=&cr=&sloc=&p=1
Always close DAO recordsets and set them to nothing before the end
of the
proc. ADO recordsets don't need to be closed before setting to
nothing.
http://msdn.microsoft.com/en-us/library/ms810810.aspx
Deprecated MDAC Components
These components are still supported in the current release of MDAC,
but they might be removed in future releases. Microsoft recommends,
when you develop new applications, that you avoid using these
components. Additionally, when you upgrade or modify existing
applications, remove any dependency on these components.
* Jet: Starting with version 2.6, MDAC no longer contains Jet
components. In other words, MDAC 2.6, 2.7, 2.8, and all future MDAC
releases do not contain Microsoft Jet, Microsoft Jet OLE DB Provider,
or the ODBC Desktop Database Drivers.
* JRO: The Microsoft Jet OLE DB Provider and other related
components have been removed from the MDAC stack since MDAC 2.6. Jet
Replication Objects (JRO) is used only with Jet (Access) databases—
basically, to create or compact the Jet Database and Jet Replication
Management. JRO has been deprecated, and MDAC 2.7 will be its last
release. It will not be available on the 64-bit Windows operating
system.
Obsolete Data Access Technologies
Obsolete technologies are technologies that have not been enhanced or
updated in several product releases and that will be excluded from
future product releases. Do not use these technologies when you write
new applications. When you modify existing applications that are
written by using these technologies, consider migrating those
applications to ADO.NET.
The following components are considered obsolete:
* Data Access Objects (DAO): DAO provides access to JET (Access)
databases. This API can be used from Microsoft Visual Basic, Microsoft
Visual C++, and scripting languages. It was included with Microsoft
Office 2000 and Office XP. DAO 3.6 is the final version of this
technology. It will not be available on the 64-bit Windows operating
system.
Current MDAC Components
These components are supported in the current release. Use these
components when you develop new applications or upgrade existing
applications.
* ADO: ActiveX Data Objects (ADO) provides a high-level
programming model that will continue to be enhanced. Although a little
less performance than coding to OLE DB or ODBC directly, ADO is
straightforward to learn and use, and it can be used from script
languages, such as Microsoft Visual Basic Scripting Edition (VBScript)
or Microsoft JScript.
http://msdn.microsoft.com/en-us/library/aa227260.aspx
Fun with Schemas
Remember when we wrote the Database Analyzer using DAO a while back?
This worked great, but on Access .mdb files only. However, what
happens if we are using an OLE DB data provider and we don't know
exactly what fields are available? Well, we can accomplish the same
thing for any data source as we did using out DAO Table Analyzer,
using ADO.
Further, DAO 3.x is not thread-safe. You should use DAO only in the
primary thread of an application.
http://msdn.microsoft.com/en-us/library/yb6xfda3.aspx
.NET, the Visual C++ environment and wizards no longer support DAO
(although the DAO classes are included and you can still use them)
http://support.microsoft.com/kb/325020
SUMMARY
This article points to the "Migrating from DAO and ODBCDirect to ADO"
white paper.
MORE INFORMATION
This white paper provides a migration path for users who want to use
ADO instead of Data Access Objects (DAO) and ODBCDirect to access SQL
Server or the Microsoft Data Engine (MSDE). The white paper briefly
describes ADO components and DAO and ODBCDirect components, and
compares the object models of these two technologies. It maps the
methods and properties of DAO and ODBCDirect to the methods of ADO,
and provides a guide for revising application code that uses DAO and
ODBCDirect technology to upgrade to ADO technology to connect to SQL
Server and MSDE database engines.
Data Access Objects (DAO) 3.5 technology provides two paths to access
Open Database Connectivity (ODBC) data sources. The first is through
the JET database engine,
which is not the most efficient way to deal with intelligent database
engines such as Microsoft® SQL Server™.
which is not the most efficient way to deal with intelligent database
engines such as Microsoft® SQL Server™.
which is not the most efficient way to deal with intelligent database
engines such as Microsoft® SQL Server™.
ODBCDirect is the second path that bypasses the JET database engine,
and provides direct access to the server by connecting through ODBC
application programming interface (API).
DAO permits users to consume only JET and ODBC data sources; however,
ADO provides a lot of flexibility to users to consume all OLE DB data
sources. As long as you have Microsoft OLE DB provider as a data
source, ADO connects and communicates with the server. Microsoft
provides several OLE DB providers through Microsoft Data Access
Components (MDAC) including OLE DB Provider for ODBC Drivers and OLE
DB Provider for SQL Server (SQLOLEDB). For additional information
about MDAC, visit the following Microsoft Web site:
http://www.microsoft.com/data/
You can also develop your own OLE DB providers for proprietary data
sources. ADO is designed to access and to work with data in a
relational database server and other non-relational data stores
through OLE DB providers.
ADO provides the following two methods to access a SQL Server
database:
The preferred method, is to use OLE DB Provider for SQL Server to
connect to the database from ADO. With this method, SQL Server exposes
significant native functionality that is based on the native OLE DB
Provider for SQL Server and provides users with faster and better
access.
Provider=MSDASQL.1;Persist Security Info=False;Data
Source=mytestDsn;Initial Catalog=Northwind
Notice the keyword Provider in the connection string. MSDASQL is not a
SQL Server Provider. It is an OLE DB Provider for ODBC DriversObject
Models.
The second method is to use OLE DB Provider for ODBC Drivers to
connect to the database. This method uses the SQL Server ODBC Driver.
The connection string looks similar to the following:
Moreover, ADO object model has fewer objects, but has more properties,
methods, and method arguments than DAO and ODBCDirect. ADO is thread-
safe, but DAO is not. Therefore, do not use DAO in Active Server Pages
(ASP) pages or in multithreaded applications.
Unlike DAO and ODBCDirect object model, ADO is less hierarchical, as
shown in Figure 2. You can create most of the objects in ADO without
calling a function on another object to generate the objects.
http://www.microsoft.com/communitie...22-9b64-fb19a01ffe88&cat=&lang=&cr=&sloc=&p=1
Always close DAO recordsets and set them to nothing before the end
of the
proc. ADO recordsets don't need to be closed before setting to
nothing.
http://msdn.microsoft.com/en-us/library/ms810810.aspx
Deprecated MDAC Components
These components are still supported in the current release of MDAC,
but they might be removed in future releases. Microsoft recommends,
when you develop new applications, that you avoid using these
components. Additionally, when you upgrade or modify existing
applications, remove any dependency on these components.
* Jet: Starting with version 2.6, MDAC no longer contains Jet
components. In other words, MDAC 2.6, 2.7, 2.8, and all future MDAC
releases do not contain Microsoft Jet, Microsoft Jet OLE DB Provider,
or the ODBC Desktop Database Drivers.
* JRO: The Microsoft Jet OLE DB Provider and other related
components have been removed from the MDAC stack since MDAC 2.6. Jet
Replication Objects (JRO) is used only with Jet (Access) databases—
basically, to create or compact the Jet Database and Jet Replication
Management. JRO has been deprecated, and MDAC 2.7 will be its last
release. It will not be available on the 64-bit Windows operating
system.
Obsolete Data Access Technologies
Obsolete technologies are technologies that have not been enhanced or
updated in several product releases and that will be excluded from
future product releases. Do not use these technologies when you write
new applications. When you modify existing applications that are
written by using these technologies, consider migrating those
applications to ADO.NET.
The following components are considered obsolete:
* Data Access Objects (DAO): DAO provides access to JET (Access)
databases. This API can be used from Microsoft Visual Basic, Microsoft
Visual C++, and scripting languages. It was included with Microsoft
Office 2000 and Office XP. DAO 3.6 is the final version of this
technology. It will not be available on the 64-bit Windows operating
system.
Current MDAC Components
These components are supported in the current release. Use these
components when you develop new applications or upgrade existing
applications.
* ADO: ActiveX Data Objects (ADO) provides a high-level
programming model that will continue to be enhanced. Although a little
less performance than coding to OLE DB or ODBC directly, ADO is
straightforward to learn and use, and it can be used from script
languages, such as Microsoft Visual Basic Scripting Edition (VBScript)
or Microsoft JScript.
http://msdn.microsoft.com/en-us/library/aa227260.aspx
Fun with Schemas
Remember when we wrote the Database Analyzer using DAO a while back?
This worked great, but on Access .mdb files only. However, what
happens if we are using an OLE DB data provider and we don't know
exactly what fields are available? Well, we can accomplish the same
thing for any data source as we did using out DAO Table Analyzer,
using ADO.