
微软公司的ADO (ActiveX Data Objects) 是一个用于存取数据源的COM组件。它提供了编程语言和统一数据访问方式OLE DB的一个中间层。允许开发人员编写访问数据的代码而不用关心数据库是如何实现的,而只用关心到数据库的连接。访问数据库的时候,关于SQL的知识不是必要的,但是特定数据库支持的SQL命令仍可以通过ADO中的命令对象来执行。
目录 |
ADO被设计来继承微软早期的数据访问对象层,包括RDO (Remote Data Objects) 和DAO(Data Access Objects)。ADO在1996年冬被发布。
ADO包含一些顶层的对象:
ADO组件的使用需要利用支持COM的高级语言,例如ASP中的VBScript或者Visual Basic,甚至微软的竞争对手Borland的产品Delphi,,现在也支持使用ADO来访问数据库。
在新的编程框架.NET Framework中, 微软也提供了一个面向Internet的版本的ADO,称为ADO.NET。其对象模型和传统ADO差别很大。
使用 ADO 存取资料的一些基本步骤 :
下列的 ASP 范例使用 ADO 于 "Phonebook" 表中选取 "Name" 字段, 并设定 "PhoneNumber" 等于 "555-5555"。
dim myconnection, myrecordset, name set myconnection = server.createobject("ADODB.Connection") set myrecordset = server.createobject("ADODB.Recordset") myconnection.open mydatasource myrecordset.open "Phonebook", myconnection myrecordset.find "PhoneNumber = '555-5555'" name = myrecordset.fields.item("Name") myrecordset.close set myrecordset = nothing set myconnection = nothing
这相当于下列的 ASP code, 以 plain SQL 取代 Recordset object:
dim myconnection, myrecordset, name set myconnection = server.createobject("ADODB.connection") myconnection.open mydatasource set myrecordset = myconnection.execute("SELECT Name FROM Phonebook WHERE PhoneNumber = '555-5555'") name = myrecordset(0)
| 数据库管理系统(DBMS) ( 查看 • 讨论 • 编辑 • 历史 ) | |
|
概念 |
|
|
资料库物件 |
SQL |
| 数据库管理系统的实施 | |
|
实施类型 |
|
|
数据库产品 |
|
Why are we here?
All text is available under the terms of the GNU Free Documentation License
This page is cache of Wikipedia. History