荔园在线

荔园之美,在春之萌芽,在夏之绽放,在秋之收获,在冬之沉淀

[回到开始] [上一篇][下一篇]


发信人: Jobs (温少), 信区: Visual
标  题: 在VB中使用ADO
发信站: BBS 荔园晨风站 (Mon Nov 29 18:55:59 1999), 站内信件



Using Microsoft ActiveX Data Objects (ADO) via Visual Basic
Microsoft Corporation

May 1998

Abstract
This article discusses how to take advantage of Microsoft? ActiveX? Data
Objects (ADO) with Microsoft? Visual Basic? version 5.0. ADO 2.0 has been
integrated into Visual Basic 6.0. See the Visual Basic documentation for more
information.

What Is ADO?
ActiveX Data Objects is a programming model, which means that it is not
dependent upon any given back-end engine. ADO can access data through any OLE
DB provider. The following OLE DB providers ship with Microsoft Data Access
Components (MDAC) 2.0:

Microsoft SQL Server?


Microsoft Jet


Oracle


OLE DB Provider for ODBC (Kagera)
ODBC drivers are supported through the OLE DB Provider for ODBC, often referred
to as Kagera.

The ADO object model consists of seven objects:

Connection: Represents an open connection to an OLE DB data source.


Error: Contains details about data access errors, refreshed each time an error
occurs in a single operation involving ADO.


Command: Defines a specific command to execute against data.


Parameter: Optional collection off the Command object for any parameters to
provide to the command.


Recordset: Represents a set of records from a table, Command object, or SQL
syntax. Can be created without any underlying Connection object.


Field: Represents a single column of data in a recordset.


Property: A collection of values raised by the provider for ADO.
ADOR is a subset of this ADO object model. ADOR provides only the Recordset and
Field objects.

Installing ADO on Your Machine
With Visual Basic 6.0, ADO installs automatically. If you wish to use ADO 2.0
with a version of Visual Basic earlier than 6.0, you must follow these
instructions:

To properly install ADO on your machine, you will need to install Microsoft
Data Access Components (MDAC) 2.0, or the Microsoft Data Access SDK 2.0.
(Microsoft Data Access Components and the Data Access SDK are available free
for download from the Microsoft Data Access Web site,
http://www.microsoft.com/data/.)


After ADO is installed on your machine, simply create a new project inside
Visual Basic, click References on the Projects menu, and then select Microsoft
ActiveX Data Objects (2.0) Library.
ADO vs. DAO
If you include references to both ADO and DAO in the same project, you will
have some difficulty. Both use the same object named Recordset, so the
following code is ambiguous:

   Dim r as recordset

To specify which object model to use, include a qualifier in front:

   Dim s As ADODB.Recordset
   Dim t As DAO.Recordset

For More Information
For more information, see the Microsoft Knowledge Base article Q168342 "INFO:
Choosing the Right VB5 Data Access Interface (ADO/DAO/RDO)."

? 1999 Microsoft Corporation. All rights reserved. Terms of use.

--
☆ 来源:.BBS 荔园晨风站 bbs.szu.edu.cn.[FROM: bbs@192.168.11.111]


[回到开始] [上一篇][下一篇]

荔园在线首页 友情链接:深圳大学 深大招生 荔园晨风BBS S-Term软件 网络书店