asp 产品无限级分类

asp产品多级分类,级别不限,哪位有代码请直接写出来,谢谢!... asp 产品多级分类,级别不限,哪位有代码请直接写出来,谢谢! 展开
 我来答
louhui1018
2008-04-24 · TA获得超过4824个赞
知道大有可为答主
回答量:2002
采纳率:0%
帮助的人:1748万
展开全部
<%
'程序的核心是一个数组,显示的结果只是比较常见的两种情况,只读取了一次数据库
Dim LID,CID,TID,OID,Tmp,Url,Bof,Eof,i,ReadSQL,PgNum,PgSiz,Arr,reID,AllRs,LinkStr,
ReadPgSiz,ReadPgNum,ReadAllFd,ReadAllPg,ReadAllRs,ReadRsNum
Db = "test.mdb"
ConnStr = "Provider = Microsoft.Jet.OLEDB.4.0;Data Source = " & Server.MapPath(db)
Set conn = Server.createObject("ADODB.Connection")
conn.open ConnStr
Set NET = New Class_NET
Class Class_NET
function Read(ReadSQL,PgNum,PgSiz)
ReadSQL =(Replace(ReadSQL,"'",""))
ReadPgSiz=Int(PgSiz)
ReadPgNum=Int(PgNum)
Set ReadRs= Server.createObject("ADODB.Recordset")
ReadRs.open ReadSQL,conn,1,1
ReadRs.PageSize =ReadPgSiz
ReadAllFd =ReadRs.Fields.Count
ReadAllPg =ReadRs.PageCount
ReadAllRs =ReadRs.RecordCount
ReadRsNum =ReadRs.Absoluteposition
If int(ReadPgNum)>Int(ReadAllPg) or int(ReadPgNum)=0 Then ReadPgNum=1
ReadRs.absolutepage=ReadPgNum
'返回实际的页面记录条数
If int(ReadPgNum)=Int(ReadAllPg) Then ReadPgSiz=ReadAllRs-ReadPgSiz*(ReadAllPg-1)
'数组开始
reDim ReadRsArr(ReadAllFd-1,ReadPgSiz-1)
For ReadArrRs = 0 to ReadPgSiz-1
If ReadRs.Eof Then Exit For
For ReadArrFd = 0 to ReadAllFd-1
ReadRsArr(ReadArrFd,ReadArrRs)=ReadRs(ReadArrFd)
Next
ReadRs.MoveNext
Next
Read=ReadRsArr
End function
'=====================================================
function ClassPath(Arr,reID,AllRs,Url,LinkStr)
Tmp=Null
reID=Int(reID)
If reID=0 Then Exit function
For i=0 to AllRs-1
If int(Arr(5,i))=int(reID) Then
OID=Arr(0,i)
LID=Arr(1,i)
Exit For
End If
Next
For i=i to 0 step -1
If Arr(1,i)<=LID Then
Tmp=LinkStr&"<a href="&Url&Arr(5,i)&">"&Arr(6,i)&"</a>"&Tmp
LID=LID-1
End If
Next
ClassPath=Tmp
End function
'=====================================================
Sub SetBofEof(Arr,reID,AllRs)
If reID=0 Then
Bof=0
Eof=AllRs-1
Else
For i=0 to AllRs-1
If Arr(5,i)=reID Then
Bof=i
For j=i+1 to AllRs-1
If Arr(1,j)<=Arr(1,i) Then
Eof=j-1
Exit For
End If
If j=AllRs-1 Then Eof=AllRs-1
Next
Exit For
End If
Next
End If
End Sub
'=====================================================
function ClassList(Arr,reID,AllRs,Url)
Tmp=Null
reID=Int(reID)
Call Net.SetBofEof(Arr,reID,AllRs)
'下边这两条实现不显示总分类的功能
If reID>0 Then Bof=Bof+1
For i=Bof to Eof
For j=1 to Arr(1,i)-Arr(1,Bof)
Tmp=Tmp&" "
Next
For k=i+1 to AllRs-1
If Int(Arr(2,k))=Int(Arr(2,i)) Then
Tmp=Tmp&"┝"
Exit For
Else
If k=AllRs-1 Then
Tmp=Tmp&"┕"
Exit For
End If
End If
Next
If i=AllRs-1 Then Tmp=Tmp&"┕"
Tmp=Tmp&"<a href="&Url&Arr(5,i)&">"&Arr(6,i)&"</a><br>"
Next
ClassList=Tmp
End function
End Class
Dim reClass
reClass=request("Class")
If reClass="" or Int(reClass)<1 Then reClass=0
Dim ClassArr
ClassArr=NET.Read(" select * From Class where LID<20 Order by OID",1,999)
Dim ClassAllRs
ClassAllRs=ReadAllRs
%>
<style type="text/css">
<!--
body,a,table,div,span,td,th,input,select{font-size:9pt;font-family:"dotuml";color:#000000;}
body {background-color:#ffffff;scrollbar-base-color:#d0d0c8}
a:hover{ color:#000000 ;}
a:link,a:active,a:visited{text-decoration:none ;color:#ff4500}
.btn {background-color: #d0d0c8; height: 21px; top: 1px; width: 21px; }
-->
</style>
<%
Response.Write "当前栏目的显示"
Response.Write "<br>"
Response.Write NET.ClassPath(ClassArr,reClass,ClassAllRs,"?Class=",">>>")
Response.Write "<br>"
Response.Write "栏目列表的显示"
Response.Write "<br>"
Response.Write NET.ClassList(ClassArr,reClass,ClassAllRs,"?class=")
%>

参考资料: http://www.papozhe.com/ASP/ASP-WXFL.html

彩驰科技
2024-11-22 广告
互联网算法备案平台,专业代理代办,快速响应,高效办理!专业代理代办,快速办理,让您省时省力!专业团队为您提供优质服务,让您的互联网算法备案更顺利!咨询电话:13426378072,13436528688... 点击进入详情页
本回答由彩驰科技提供
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式