|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
由于ASP提供的是一对多的服务,所以用户的一些特殊需求很难得到满足。办理|排序|成绩
来很多网友提到论坛“上一主题”“下一主题”的显现成绩,我利用另外一种排序体例办理的,写出来,听听妙手的定见。
数据库:
ID:贴子的id号,主动编号
OrderID:排序基数,以下具体形貌
.
.
.
数据:
主体恤:第一个主题贴OrderID为aaaaaaz(个中的6个a是为了这个版面上最多能够有999999*26条主题贴,固然,您能够依据本人的必要变动。z作为排序的辨认码,永久无变更。),第二个主题贴为aaaaabz,就是说,每增添一个主题贴,OrderID下跌一个字母。
子帖:第一个子贴在父贴的OrderID的基本上,在z后面增添一名a,第二个子贴在父贴的OrderID的基本上,在z的后面增添一名b,以此类推。也就是说,统一层的贴子,每增添一个,OrderID下跌一个字母,同上,z永久稳定。
能够看出,统一层的贴子OderID的位数不异;而复兴统一主题的贴子,OrderID的前n位不异;如许,贴子地点层数能够由OrderID的位数得出;而贴子的整体排序byOrderIDdesc;而上一主题贴就是字符减一,下一主题贴就是字符加一咯!讲话:add_massege.asp
------------部分,未经优化收拾------------
<bodybgcolor="#C8C8E6">
<scriptlanguage="VBScript">
SubGoBack()
form1.btn1.value="前往"
history.go(-1)
endsub
</Script>
<%
name1=Session("Uname")
Ifname1=""Then
Response.Write"<fontsize=3color=blue><center>"
Response.Write"<br>"
Response.Write"<br>"
Response.Write"只要会员才干利用此项功效,请您注册或登录!<p>"
Response.Write"<ahref=main1.htm>回上页</a>"
Response.End
EndIf
psw1=Session("Upsw")
orderid=Request("txtOrderid")
face=Request("R1")
level=Request("txtLevel")
name=Request("txtName")
psw=Request("txtPsw")
work=Session("Uwork")
add=Session("Uadd")
eee=Session("Unid")
mail=Request("txtMail")
subject=Request("txtSubject")
ip=Request.ServerVariables("Remote_Addr")
Ifname=""ORpsw=""Then
Response.Write"<fontsize=5color=blue><center>"
Response.Write"<br>"
Response.Write"<br>"
Response.Write"请填写你的名字/暗码~<p>"
%>
<formname=form1>
<inputtype="button"name="btn1"value="前往">
</form>
<%
Response.End
EndIf
Ifnamename1Orpswpsw1Then
Response.Write"<fontsize=5color=blue><center>"
Response.Write"<br>"
Response.Write"<br>"
Response.Write"您的名字/暗码有毛病,请细心填写!~<p>"
%>
<formname=form1>
<inputtype="button"name="btn1"value="前往">
</form>
<%
Response.End
EndIf
Ifsubject=""Then
Response.Write"<fontsize=5color=blue><center>"
Response.Write"<br>"
Response.Write"<br>"
Response.Write"请填写您的讲话主题~<p>"
%>
<formname=form1>
<inputtype="button"name="btn1"value="前往">
</form>
<%
Response.End
EndIf
IForderid""Then
j=Len(orderid)
mmm=Left(orderid,j-1)
Setconn=Server.CreateObject("ADODB.Connection")
DBPath=Server.MapPath("../fpdb/massege.mdb")
conn.Open"Driver={MicrosoftAccessDriver(*.mdb)};dbq="&DBPath
SetRS=conn.Execute("SelectA_ID,A_OrderIDFromMASSEGE")
DOWhilenotRS.EOF
nnn=RS("A_OrderID")
IfLeft(nnn,j-1)=mmmThen
aaa=Asc(Mid(nnn,j,1))
Ifaaa=122Then
qqq=mmm+"a"+"z"
Else
qqq=mmm+Chr(aaa+1)+"z"
EndIf
EndIf
RS.MoveNext
Loop
RS.Close
conn.Close
Else
Setmyconn=Server.CreateObject("ADODB.Connection")
DBPath=Server.MapPath("../fpdb/massege.mdb")
myconn.Open"Driver={MicrosoftAccessDriver(*.mdb)};dbq="&DBPath
SQLcmd1="Select*FromMASSEGEWhereA_Level=0OrderByA_IDDESC"
SetRS=myconn.Execute(SQLcmd1)
nnn=RS("A_OrderID")
a=Asc(Left(nnn,1))
b=Asc(Mid(nnn,2,1))
c=Asc(Mid(nnn,3,1))
d=Asc(Mid(nnn,4,1))
e=Asc(Mid(nnn,5,1))
f=Asc(Mid(nnn,6,1))
%>
<%=Chr(a)%>11<%=Chr(b)%>22<%=Chr(c)%>33<%=Chr(d)%>44<%=Chr(e)%>55<%=Chr(f)%>66
<%
Iff<122Then
qqq=Chr(a)+Chr(b)+Chr(c)+Chr(d)+Chr(e)+Chr(f+1)+"z"
%>
<%=qqq%>77
<%
Else
Ife<122Then
qqq=Chr(a)+Chr(b)+Chr(c)+Chr(d)+Chr(e+1)+"az"
%>
<%=qqq%>88
<%
Else
Ifd<122Then
qqq=Chr(a)+Chr(b)+Chr(c)+Chr(d+1)+"aaz"
%>
<%=qqq%>99
<%
EndIf
EndIf
EndIf
RS.Close
myconn.Close
Endif
text=Server.HTMLEncode(Request("txtText"))
%>
<%=text%>
<%Onerrorresumenext
Setconn=Server.CreateObject("ADODB.Connection")
DBPath=Server.MapPath("../fpdb/massege.mdb")
conn.Open"DRIVER={MicrosoftAccessDriver(*.mdb)};dbq="&DBPath
SQLcmd="InsertIntoMASSEGE(A_OrderID,A_Level,A_Name,A_NID,A_Work,A_Add,A_Mail,A_Subject,A_Text,A_IP,A_Time)Values("&qqq&","&level&","&name&","&eee&","&work&","&add&","&mail&","&subject&","&text&","&ip&","&now&")"
conn.ExecuteSQLcmd
conn.Close
Response.Redirect"succ.htm"
%>
</body>
显现:(排序)main.asp
--------部分,未经优化处置-------
<%
ConstadOpenStatic=3
ConstadLockPessimistic=2
Setconn=Server.CreateObject("ADODB.Connection")
SetRS=Server.CreateObject("ADODB.Recordset")
DBPath=Server.MapPath("../fpdb/massege.mdb")
conn.Open"DRIVER={MicrosoftAccessDriver(*.mdb)};dbq="&DBPath
SQLcmd="Select*FromMASSEGEOrderByA_OrderIDDesc"
RS.OpenSQLcmd,conn,adOpenStatic,adLockPessimistic
page=CLng(Request("txtpage"))
RS.PageSize=30
IfPage<1ThenPage=1
Ifpage>RS.PageCountThenpage=RS.PageCount
RS.AbsolutePage=page
%>
<formaction="main.asp"method="get">
<tablealign="center"border="0"cellspacing="0"cellpadding="0">
<tr>
<tdstyle="border-left:1solid#FFFF00;border-right:1solid#FFFF00;border-bottom:2solid#FFFF00"><ahref="speak.asp"target="rbottom"><fontcolor="#0000FF">讲话</font></a></td>
<tdstyle="border-left:1solid#FFFF00;border-right:1solid#FFFF00;border-bottom:2solid#FFFF00"><ahref="main.asp"><fontcolor="#0000FF">革新</font></a></td>
<tdheight="1"style="border-left:1solid#FFFF00;border-right:1solid#FFFF00;border-bottom:2solid#FFFF00"><fontcolor="#0000FF">留言笔数:<%=RS.RecordCount%></font></td>
<tdheight="1"style="border-left:1solid#FFFF00;border-right:1solid#FFFF00;border-bottom:2solid#FFFF00"><fontcolor="#0000FF">总页数:<%=RS.PageCount%></font></td>
<tdheight="1"style="border-left:1solid#FFFF00;border-right:1solid#FFFF00;border-bottom:2solid#FFFF00"><fontcolor="#0000FF">今朝页次:<%=page%></font></td>
<tdvalign="top"align="left"height="1"style="border-left:1solid#FFFF00;border-right:1solid#FFFF00;border-bottom:2solid#FFFF00"><fontcolor="#0000FF">转到<inputtype="text"name="txtpage"size="2"style="font-size:8pt;border-style:dotted;border-width:1">页</font></td>
<tdstyle="border-left:1solid#FFFF00;border-right:1solid#FFFF00;border-bottom:2solid#FFFF00">
<fontcolor="#0000FF">
<%
Ifpage1Then
Response.Write"<ahref=main.asp?txtpage=1>第一页</a>"%></font></td>
<tdstyle="border-left:1solid#FFFF00;border-right:1solid#FFFF00;border-bottom:2solid#FFFF00">
<fontcolor="#0000FF">
<%Response.Write"<ahref=main.asp?txtpage="&(page-1)&">上一页</a>"%></font></td>
<%
EndIf
IfpageRS.PageCountThen%><tdstyle="border-left:1solid#FFFF00;border-right:1solid#FFFF00;border-bottom:2solid#FFFF00">
<fontcolor="#0000FF">
<%Response.Write"<ahref=main.asp?txtpage="&(page+1)&">下一页</a>"%></font></td>
<tdstyle="border-left:1solid#FFFF00;border-right:1solid#FFFF00;border-bottom:2solid#FFFF00"><fontcolor="#0000FF"><%Response.Write"<ahref=main.asp?txtpage="&RS.PageCount&">最初一页</a>"
EndIf
%></font></td>
<tdstyle="border-left:1solid#FFFF00;border-right:1solid#FFFF00;border-bottom:2solid#FFFF00"><ahref="pob_massege.asp"><fontcolor="#0000FF">精髓</font></a></td>
<tdstyle="border-left:1solid#FFFF00;border-right:1solid#FFFF00;border-bottom:2solid#FFFF00"><ahref="baoqian.htm"><fontcolor="#0000FF">检索</font></a></td>
<%
IfApplication("Ukingliu")="kingliu"Then
aaa="on"
Else
aaa="off"
EndIf
%>
<tdstyle="border-left:1solid#FFFF00;border-right:1solid#FFFF00;border-bottom:2solid#FFFF00"><fontcolor="#0000FF">本版斑竹:<ahref="mailto:kingliuzk@chinaren.com">沧海为水</a><ahref="massege.asp?txtID=<%=RS("A_ID")%>"target="rbottom"><%=Server.HTMLEncode(RS("A_Subject"))%></a>
<%
IfRS("A_Text")=""Then
Response.Write"<无内容>"
EndIf
%>
{ID:<%=RS("A_ID")%>}【<%=RS("A_Name")%>ID:<%=RS("A_NID")%>】<<%=RS("A_Time")%>>『点击:<%=RS("A_Times")%>』</td>
</tr>
</table>
<%
RS.MoveNext
IfRS.EOFThenExitFor
Next
RS.Close
conn.Close
缺点:安全性不是太差了,还行,只要你充分利用系统自带的工具;唯一缺点就是执行效率慢,如何进行网站优化以后,效果会比较好。 |
|