w3pop.com :: 网络学院 :: ADO :: ADO RecordCount 属性
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。
objRecordset.RecordCount |
<%
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