- 相关推荐
asp分页代码是什么
ASP即Active Server Pages,是MicroSOft公司开发的服务器端脚本环境,可用来创建动态交互式网页并建立强大的web应用程序。下面就由yjbys小编给大家介绍ASP分页代码。
用这一句调用:
<%
call PageControl(iCount,maxpage,page,"border=0 align=right","<p align=center>",per_page)
%>
<%
Sub PageControl(iCount,pagecount,page,table_style,font_style,per_page)
'生成上一页下一页链接
Dim query, a, x, temp
action = "http://" & Request.ServerVariables("HTTP_HOST") & Request.ServerVariables("SCRIPT_NAME")
temp=""
Response.Write("<table " & Table_style & ">" & vbCrLf )
Response.Write("<form method=get document.location = '" & action & "?zid="& zid & gro_page & "&" & temp & "Page='+ this.page.value;return false;""><TR>" & vbCrLf )
Response.Write("<TD align=right>" & vbCrLf )
Response.Write(font_style & vbCrLf )
if page<=1 then
Response.Write ("首页 " & vbCrLf)
Response.Write ("上页 " & vbCrLf)
else
Response.Write("<A HREF=" & action & "?zid="& zid & gro_page & "&" & temp & "Page=1>首页</A> " & vbCrLf)
Response.Write("<A HREF=" & action & "?zid="& zid & gro_page & "&" & temp & "Page=" & (Page-1) & ">上页</A> " & vbCrLf)
end if
if page>=pagecount then
Response.Write ("下页 " & vbCrLf)
Response.Write ("尾页 " & vbCrLf)
else
Response.Write("<A HREF=" & action & "?zid="& zid & gro_page & "&" & temp & "Page=" & (Page+1) & ">下页</A> " & vbCrLf)
Response.Write("<A HREF=" & action & "?zid="& zid & gro_page & "&" & temp & "Page=" & pagecount & ">尾页</A> " & vbCrLf)
end if
Response.Write(" 页次:" & page & "/" & pageCount & "页" & vbCrLf)
Response.Write(" 共有" & iCount & "条/每页"&per_page&"条" & vbCrLf)
Response.Write(" 转到" & "<INPUT TYEP=TEXT SIZE=4 Maxlength=8 VALUE=" & page & ">" & "页" & vbCrLf & "<INPUT type=submit style=""font-size: 9pt"" value=GO )
Response.Write("</TD>" & vbCrLf )
Response.Write("</TR></form>" & vbCrLf )
Response.Write("</table>" & vbCrLf )
End Sub
%>
读取数据库代码:
<%
if tab_recall_tga="1" then
o_zid=zid
zid=tab_recall_cd(0)
subt_where=" where newtype='"&tab_recall_cd(1)&"'"
end if
i=0
exec="select newsname,adddate,newsid,imgurl,summary from Mlist_"&zid&subt_where&" order by adddate desc"
set rs=server.CreateObject("adodb.recordset")
rs.open exec,conn,1,1
if rs.eof and rs.bof then
response.write "目前还没有任何数据"
else
rs.PageSize =5 '每页记录条数
iCount=rs.RecordCount '记录总数
iPageSize=rs.PageSize
maxpage=rs.PageCount
page=request("page")
per_page=rs.PageSize
if Not IsNumeric(page) or page="" then
page=1
else
page=cint(page)
end if
if page<1 then
page=1
elseif page>maxpage then
page=maxpage
end if
rs.AbsolutePage=Page
if page=maxpage then
x=iCount-(maxpage-1)*iPageSize
else
x=iPageSize
end if
For i=1 To x
if rs("newtype")=0 then
show_type=""
else
show_type=""
end if
uimg="0"
imgurl=trim(rs("imgurl"))
if len(imgurl)>0 then uimg="1"
if uimg<>"1" then imgurl="img/no.jpg"
%>
<table width="98%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="140" valign="top">
<table width="162" height="90" border="0" cellpadding="0" cellspacing="1" bgcolor="C5C5C5">
<tr>
<td width="169" align="center" bgcolor="#FFFFFF"><img src="<%=imgurl%>" alt="<%=rs("newsname")%>" width="174" height="91" border="0"></td>
</tr>
</table></td>
<td height="70" valign="top">
<table width="97%" border="0" align="right" cellpadding="0" cellspacing="0">
<tr>
<td width="88%" height="25"><strong><font color="#000000"><%=rs("newsname")%></font></strong> 发布时间:<%=rs("adddate")%></td>
<td> </td>
</tr>
<tr>
<td height="65" valign="top"><%=rs("summary")%></td>
<td width="12%" align="right" valign="bottom"><a href="m_news.asp?zid=<%=zid%>&id=<%=rs("newsid")%>">详细>></a></td>
</tr>
</table></td>
</tr>
<tr>
<td colspan="2" valign="top"><hr size="1" noshade></td>
</tr>
</table>
<% RS.MoveNext
next
end if
rs.close
set rs=nothing
if tab_recall_tga="1" then zid=o_zid '重新恢复虚拟定向表
%>
插入代码:
exec="insert into Admin(user_id,user_pwd,lev)values('"&o_user_id&"','"&o_user_pwd&"','"&o_lev&"')"
'response.write exec
conn.execute exec
conn.close
set conn=nothing
更新代码:
rs.update
rs.close
set rs=nothing
conn.close
set conn=nothing
【asp分页代码是什么】相关文章:
asp缓存类代码09-28
asp获取当前URL代码实例10-14
关于ASP模板类代码参考08-29
asp.net 组合模式的PHP代码10-07
HTML代码是什么05-10
防盗链接ASP函数实现代码08-03
关于ASP读取IIS日志的小程序代码08-29
asp.net 动态引用样式表代码示范06-14