网络学院 w3pop社区 网络资源 IT新闻

w3pop.com :: 网络学院 :: ADO :: ADO BOF 与 EOF 属性

会员登陆

帐号

密码

回答

记住密码

忘记密码? 注册

ADO BOF 与 EOF 属性


作者:w3pop.com 翻译/整理:w3pop.com 发布:2007-04-28 浏览:1253 :: ::

The BOF property returns True (-1) if the current record position is before the first record in the Recordset, otherwise it returns False (0).
如果当前记录指针位于记录集中的第一条记录之前,则返回True(-1);否则返回False(0)。

The EOF property returns True (-1) if the current record position is after the last record in the Recordset, otherwise it returns False (0).
如果当前记录指针位于记录集中的最后一条记录之后,则返回True(-1);否则返回False(0)。

Note: The BOF and EOF properties are set to True if you open an empty Recordset. RecordCount property is zero.
注意:如果你打开一个空的记录集,那么BOF和EOF属性都为True,此时,RecordCount属性为0。

Note: If a Recordset holds at least one record, the first record is the current and the BOF and EOF properties are False.
注意:如果一个记录集保留了至少一条记录,那么当前记录就是第一条记录,且此时BOF和EOF的属性值都为False。

Syntax
语法

objRecordset.BOF
or
objRecordset.EOF

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 Companyname, Contactname FROM Customers"
rs.Open sql, conn
%>

<table border="1" width="100%">
<%while rs.EOF=false%>
    <tr>
      <%for each x in rs.Fields%>
       <td><%Response.Write(x.value)%></td>
    <%next
    rs.MoveNext%>
    </tr>
<%wend
rs.close
conn.close
%>

评论 (0) All