当前位置: 首页 > 网络学院 > 服务端脚本教程 > ADO > ADO GetRows 方法

ADO
ADO DataTypes
ADO 摘要
ADO 实例

ADO GetRows 方法


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

The GetRows method copies multiple records from a Recordset object into a two-dimensional array.
GetRows的作用是:将一个记录集对象中的多个记录复制到一个二维数组中。

Syntax
语法

vararray=objRecordset.GetRows(rows,start,fields)

Parameter参数 Description描述
rows Optional. A GetRowsOptionEnum value that specifies the number of records to retrieve. Default is adGetRowsRest.
可选参数。指定一个GetRowsOptionEnum值,用于指定需要提取记录的数量。默认值为adGetRowsRest

Note: If you omit this argument it will retrieve all records in the Recordset
注意:如果你忽略了这个自变量,它将从记录集中提取所有的记录

start

Optional. What record to start on, a record number or a BookmarkEnum value
可选参数。指定起始记录。可以是一个数值或一个BookmarkEnum值

fields Optional. If you want to specify only the fields that the GetRows call will return, it is possible to pass a single field name/number or an array of field names/numbers in this argument
可选参数。如果你只指定字段,那么将返回GetRows请求;你可以将一个字段值/字段号或是一个“字段值/字段号”数组传到该自变量中

Example
案例

<%
set conn=Server.CreateObject("ADODB.Connection")
conn.Provider="Microsoft.Jet.OLEDB.4.0"
conn.Open(Server.Mappath("northwind.mdb"))
set rs = Server.CreateObject("ADODB.recordset")
rs.Open "Select * from Customers", conn
'The first number indicates how many records to copy
'The second number indicates what recordnumber to start on
p=rs.GetRows(2,0)
rs.close
conn.close
'This example returns the value of the first
'column in the first two records
response.write(p(0,0))
response.write("<br>")
response.write(p(0,1))
'This example returns the value of the first
'three columns in the first record
response.write(p(0,0))
response.write("<br>")
response.write(p(1,0))
response.write("<br>")
response.write(p(2,0))
%>


GetRowsOptionEnum Values

Constant常量 Value值 Description描述
adGetRowsRest -1 Retrieves the rest of the records in the Recordset object
提取记录集对象中的剩余记录


BookmarkEnum Values

Constant常量 Value值 Description描述
adBookmarkCurrent 0 Starts at the current record
指定从当前记录开始
adBookmarkFirst 1 Starts at the first record
指定从第一条记录开始
adBookmarkLast 2 Starts at the last record
指定从最后一条记录开始

评论 (0) All

登陆 | 还没注册?