Article ID: 168335 - Last Review: March 2, 2005 - Revision: 3.3 INFO: Using ActiveX Data Objects (ADO) via Visual BasicThis article was previously published under Q168335 On This PageSUMMARY
This article discusses what is necessary to take advantage of ActiveX Data
Objects (ADO) with Visual Basic.
MORE INFORMATIONWhat is ADO?ActiveX Data Objects is a programming model, which means that it is not dependent upon any given back-end engine. Currently, however, the only engine supporting the ADO model is OLE-DB. There are many native OLE-DB Providers as well as an OLE-DB Provider for ODBC.The ADO object model consists of six objects:
Installing ADO on your ComputerTo properly install ADO on your computer, you need to install MDAC. This installs both ADO and necessary underlying ADO components. OLE-DB also requires ODBC version 3.0 or later components.MDAC is available free for download from the Web at the following URL: http://msdn.microsoft.com/en-us/data/aa937729.aspx
(http://msdn.microsoft.com/en-us/data/aa937729.aspx)
After ADO is installed on your computer, create a new project inside
Visual Basic. From the Projects menu, choose References, and then select Microsoft ActiveX Data Objects Library.
The documentation for the ADO Error object indicates that the Errors Collection will be populated if any error occurs within ADO or its underlying provider. This is somewhat incorrect. Depending on the source of the error, ADO's errors collection may not be populated. You need to check both the Visual Basic Error object as well as the ADO Errors collection. ADO vs. DAOIf you include references to both ADO and DAO in the same project, you may have some difficulty. Both use a Recordset object, so the following code is ambiguous:
runtime error 13: datatype mismatch
To specify which object model you want to use, include a qualifier in
front:
REFERENCES
For more information, please see the following article in the Microsoft Knowledge Base: 167957
(http://support.microsoft.com/kb/167957/EN-US/
)
INFO: Extracting Error Information from ADO in VB APPLIES TO
| Article Translations
|
Back to the top
