當前位置:才華齋>設計>網頁設計>

asp分頁程式碼是什麼

網頁設計 閱讀(2.09W)

ASP即Active Server Pages,是MicroSOft公司開發的.HRef="https://caihuazhai.com/tags-163d-0.html" target="_blank" >服務器端指令碼環境,可用來建立動態互動式網頁並建立強大的web應用程式。下面就由yjbys小編給大家介紹ASP分頁程式碼。

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://" & erVariables("HTTP_HOST") & erVariables("SCRIPT_NAME")

temp=""

e("<table " & Table_style & ">" & vbCrLf )

e("<form method=get tion = '" & action & "?zid="& zid & gro_page & "&" & temp & "Page='+ e;return false;""><TR>" & vbCrLf )

e("<TD align=right>" & vbCrLf )

e(font_style & vbCrLf )

if page<=1 then

e ("首頁 " & vbCrLf)

e ("上頁 " & vbCrLf)

else

e("<A HREF=" & action & "?zid="& zid & gro_page & "&" & temp & "Page=1>首頁</A> " & vbCrLf)

e("<A HREF=" & action & "?zid="& zid & gro_page & "&" & temp & "Page=" & (Page-1) & ">上頁</A> " & vbCrLf)

end if

if page>=pagecount then

e ("下頁 " & vbCrLf)

e ("尾頁 " & vbCrLf)

else

e("<A HREF=" & action & "?zid="& zid & gro_page & "&" & temp & "Page=" & (Page+1) & ">下頁</A> " & vbCrLf)

e("<A HREF=" & action & "?zid="& zid & gro_page & "&" & temp & "Page=" & pagecount & ">尾頁</A> " & vbCrLf)

end if

e(" 頁次:" & page & "/" & pageCount & "頁" & vbCrLf)

e(" 共有" & iCount & "條/每頁"&per_page&"條" & vbCrLf)

e(" 轉到" & "<INPUT TYEP=TEXT SIZE=4 Maxlength=8 VALUE=" & page & ">" & "頁" & vbCrLf & "<INPUT type=submit style=""font-size: 9pt"" value=GO )

e("</TD>" & vbCrLf )

e("</TR></form>" & vbCrLf )

e("</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=teObject("rdset")

exec,conn,1,1

if and then

e "目前還沒有任何資料"

else

Size =5 '每頁記錄條數

iCount=rdCount '記錄總數

iPageSize=Size

maxpage=Count

page=request("page")

per_page=Size

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

lutePage=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>&nbsp;&nbsp;釋出時間:<%=rs("adddate")%></td>

<td>&nbsp;</td>

</tr>

<tr>

<td height="65" valign="top"><%=rs("summary")%></td>

<td width="12%" align="right" valign="bottom"><a href="m_("newsid")%>">詳細&gt;&gt;</a></td>

</tr>

</table></td>

</tr>

<tr>

<td colspan="2" valign="top"><hr size="1" noshade></td>

</tr>

</table>

<% Next

next

end if

e

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&"')"

'e exec

ute exec

e

set conn=nothing

更新程式碼:

te

e

set rs=nothing

e

set conn=nothing