Menu
×
   ❮     
HTML CSS JAVASCRIPT SQL PYTHON JAVA PHP HOW TO W3.CSS C C++ C# BOOTSTRAP REACT MYSQL JQUERY EXCEL XML DJANGO NUMPY PANDAS NODEJS R TYPESCRIPT ANGULAR GIT POSTGRESQL MONGODB ASP AI GO KOTLIN SASS VUE DSA GEN AI SCIPY AWS CYBERSECURITY DATA SCIENCE
     ❯   

ADO GetRows 方法


❮ 记录集对象完整参考

GetRows 方法将记录集对象中的多个记录复制到二维数组中。

语法

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

参数 描述
rows 可选。一个 GetRowsOptionEnum 值,指定要检索的记录数量。默认值为 adGetRowsRest。

注意: 如果省略此参数,它将检索记录集中所有记录。

start

可选。从哪条记录开始,记录号或 BookmarkEnum

fields 可选。如果您只想指定 GetRows 调用将返回的字段,则可以在此参数中传递单个字段名称/编号或字段名称/编号数组。

示例

<%
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

'第一个数字表示要复制的记录数量
'第二个数字表示从哪个记录号开始
p=rs.GetRows(2,0)
rs.close
conn.close

'此示例返回前两个记录中第一列的值
'列
response.write(p(0,0))
response.write("<br>")
response.write(p(0,1))

'此示例返回前两个记录中第一列的值
'第一条记录中的三列
response.write(p(0,0))
response.write("<br>")
response.write(p(1,0))
response.write("<br>")
response.write(p(2,0))
%>

GetRowsOptionEnum 值

常量 描述
adGetRowsRest -1 检索记录集对象中剩余的所有记录

BookmarkEnum 值

常量 描述
adBookmarkCurrent 0 从当前记录开始
adBookmarkFirst 1 从第一条记录开始
adBookmarkLast 2 从最后一条记录开始

❮ 记录集对象完整参考
×

Contact Sales

If you want to use W3Schools services as an educational institution, team or enterprise, send us an e-mail:
[email protected]

Report Error

If you want to report an error, or if you want to make a suggestion, send us an e-mail:
[email protected]

W3Schools is optimized for learning and training. Examples might be simplified to improve reading and learning. Tutorials, references, and examples are constantly reviewed to avoid errors, but we cannot warrant full correctness of all content. While using W3Schools, you agree to have read and accepted our terms of use, cookie and privacy policy.

Copyright 1999-2024 by Refsnes Data. All Rights Reserved. W3Schools is Powered by W3.CSS.