本文主要是介绍asp 读取记录 从指定第几条读到几条 方法,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
for i = 1 to rs.recordcount
if i>5 then
end if
if i<9 and i>4 then
end if
rs.movenext
if rs.eof then exit for
next
例子:
<table width="90%" border="0" align="center" cellpadding="0" cellspacing="0">
<%
set adoRs=server.CreateObject("adodb.recordset")
sql = "select * from db_channel where ParentID = 12 "
adoRs.open sql,conn,1,3
for i = 1 to adoRs.recordcount
if i>4 and i<9 then
%>
<tr>
<td height="27" class="title" >·<a href="/page/default.asp?pageID=<%=Trim(adoRs("pageID"))%>" class="title" style="color:#ffffff; font-weight:bold" title="<%=adoRs("pagename")%>">
<%
if len(adoRs("pagename")) >15 then
response.Write(left(adoRs("pagename"),14)&"...")
else
response.Write(adoRs("pagename"))
end if
%>
</a></td>
</tr>
<%
end if
adoRs.movenext
if adoRs.eof then exit for
next
adoRs.close
%>
</table>
其中 创建的数据表必须打开
(1)、
sql = "select * from db_channel where ParentID = 12 "
Set adoRs = conn.execute(sql)
(2)、第2种打开了
set adoRs=server.CreateObject("adodb.recordset")
sql = "select * from db_channel where ParentID = 12 "
adoRs.open sql,conn,1,3
这篇关于asp 读取记录 从指定第几条读到几条 方法的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!