当前位置: 首页 > 网络学院 > 服务端脚本教程 > ADO > ADO RecordCount 属性

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 RecordCount 属性


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

The RecordCount property returns a long value that indicates the number of records in a Recordset object.
RecordCount属性的作用是:返回一个长值,用于指定记录对象中的记录数量。

If the Recordset object supports AbsolutePosition and AbsolutePage properties or bookmarks (if Supports(adApproxPosition) or Supports(adBookmark) returns true), this property will return the exact number of records in the Recordset.
如果记录对象支持AbsolutePosition和AbsolutePage属性或标签(如果Supports(adApproxPosition) 或Supports(adBookmark)的值返回True),那么这个属性将返回记录集中准确的记录数字。

Note: This property will return -1 for a forward-only cursor; the actual count for a static or keyset cursor; and -1 or the actual count for a dynamic cursor.
注意:如果是forward-only[前置],该属性值为-1;如果是一个static[静态]指针或是一个keyset[键盘]指针,那么它的属性值为真实记录值;如果它是一个dynamic[动态]指针,那么它的属性值是-1或真实记录值。

Note: The Recordset object must be open when calling this property. If this property is not supported it will return -1.
注意:Recordset[记录集]对象必须在请求RecordCount属性之前打开。如果这个属性不支持Recordset[记录集]对象将返回-1。

Syntax
语法

objRecordset.RecordCount

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")
sql="SELECT * FROM Customers"
rs.Open sql,conn
if rs.Supports(adApproxPosition)=true then i=rs.RecordCount response.write("The number of records is: " & i)
end if
rs.Close
conn.Close
%>

评论 (0) All

登陆 | 还没注册?