当前位置: 首页 > 网络学院 > 服务端脚本教程 > ADO > ADO记录集

ADO
ADO介绍
ADO数据库连接
ADO记录集
ADO显示记录
ADO查询语句
ADO记录排序
ADO添加记录
ADO更新记录
ADO删除记录
ADO演示
ADO提升执行速度
ADO Command对象
ADO Connection对象
ADO Error
ADO Field
ADO Parameter
ADO 属性
ADO Record
ADO Recordset
ADO Stream

ADO 中的 ADO记录集


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-03-01   浏览: 1026 ::
收藏到网摘: n/a

To be able to read database data, the data must first be loaded into a recordset. 
要读取数据库中的数据,首先得将数据加载进一记录集中.


Create an ADO Table Recordset
建立ADO记录集

After an ADO Database Connection has been created, as demonstrated in the previous chapter, it is possible to create an ADO Recordset.  
在如上一章节所演示的,建立一ADO数据库连接后就能够建立一ADO记录集.

Suppose we have a database named "Northwind", we can get access to the "Customers" table inside the database with the following lines:
假设我们已经有了一名为Northwind数据库,我们就可以用下面这些代码来访问该数据库中的Customes这张表:

<%
set conn=Server.CreateObject("ADODB.Connection")
conn.Provider="Microsoft.Jet.OLEDB.4.0"

conn.Open "c:/webdata/northwind.mdb"
set rs=Server.CreateObject("ADODB.recordset")
rs.Open "Customers", conn
%>


Create an ADO SQL Recordset
建立ADO SQL 记录集

We can also get access to the data in the "Customers" table using SQL:
我们还可以使用在SQL中的Customers数据表:

<%
set conn=Server.CreateObject("ADODB.Connection")
conn.Provider="Microsoft.Jet.OLEDB.4.0"

conn.Open "c:/webdata/northwind.mdb"
set rs=Server.CreateObject("ADODB.recordset")
rs.Open "Select * from Customers", conn
%>


Extract Data from the Recordset
从数据集中提取数据

After a recordset is opened, we can extract data from recordset.  
数据集打开后,我们就能够从里面提取我们所需要的数据

Suppose we have a database named "Northwind", we can get access to the "Customers" table inside the database with the following lines:
假设我们已经有了一名为Northwind数据库,我们就可以用下面这些代码来访问该数据库中的Customes这张表:

<%
set conn=Server.CreateObject("ADODB.Connection")
conn.Provider="Microsoft.Jet.OLEDB.4.0"

conn.Open "c:/webdata/northwind.mdb"
set rs=Server.CreateObject("ADODB.recordset")
rs.Open "Select * from Customers", conn
for each x in rs.fields
response.write(x.name)
response.write(" = ")
response.write(x.value)
next
%>


The ADO Recordset Object
ADO 记录集对象

The ADO Recordset object is used to hold a set of records from a database table. 
ADO记录集对象是用做寄放来自数据库的记录集

View all methods and properties of the Recordset object.
查看所有Recordset对象的方法和属性

评论 (1) 1 All

登陆 | 还没注册?