我想做一棵不同寻常的二杈树(金字塔形的),高手给指点一下吧

wangbo456 2004-06-18 04:22:07
我想做一棵能按如下界面显示的树:

1
11 12
111 112 121 122
1111 1112 1121 1122 1211 1212 1221 1222

节点是能无限往下延伸的,我的数据库表应该怎样设计呢?我应该怎样实现显示功能呢?
...全文
96 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
gjd111686 2004-07-05
  • 打赏
  • 举报
回复
数据库结构
ID
Role //节点值
Class //节点层[根节点为0]
ParentID //父节点[无父节点为NULL]

<%
Dim iCount_0,iCount_1,iCount_2,iCount_3
iCount_0="1"
Session("DataCmd").CommandText="select Count(Class) from ManageStruct where Class='1'"
Set Session("DataCmd").ActiveConnection=Session("DataConn")
Set Rs_Count=Session("DataCmd").Execute
If Not Rs_Count.Eof Then
iCount_1=Rs_Count(0)
End If
Session("DataCmd").CommandText="select Count(Class) from ManageStruct where Class='2'"
Set Session("DataCmd").ActiveConnection=Session("DataConn")
Set Rs_Count=Session("DataCmd").Execute
If Not Rs_Count.Eof Then
iCount_2=Rs_Count(0)
End If
Session("DataCmd").CommandText="select Count(Class) from ManageStruct where Class='3'"
Set Session("DataCmd").ActiveConnection=Session("DataConn")
Set Rs_Count=Session("DataCmd").Execute
If Not Rs_Count.Eof Then
iCount_3=Rs_Count(0)
End If
Dim TableRow,TableCol
TableRow=4
TableCol=CInt(iCount_0)*CInt(iCount_1)*CInt(iCount_2)*CInt(iCount_3)
Rem Response.Write iCount_0&"|"&iCount_1&"|"&iCount_2&"|"&iCount_3&"<br>"
Response.Write "<table border='0' cellpadding='0' cellspacing='0' width='80%'>"
For iRow=1 To TableRow
Response.Write "<tr>"
For iCol=1 To TableCol
Response.Write "<td>"
Rem 算法有些问题开始???
Session("DataCmd").CommandText="select * from ManageStruct where Class='"&CStr(iRow-1)&"' And ParentID='"&Cstr(iCol)&"'"
Rem 算法有些问题结束
Set Session("DataCmd").ActiveConnection=Session("DataConn")
Set Session("rs_main")=Session("DataCmd").Execute
If Not Session("rs_main").Eof Then
Response.Write "<table border='0' cellpadding='0' cellspacing='0' width='100%'>"
Response.Write "<tr>"
Response.Write "<td width='33%'> </td>"
Response.Write "<td width='33%'> </td>"
Response.Write "<td width='34%'> </td>"
Response.Write "</tr>"
Response.Write "<tr>"
Response.Write "<td width='33%'> </td>"
Response.Write "<td width='33%' bgcolor='#8CAADC'>"&Session("rs_main")("Role")&"</td>"
Response.Write "<td width='34%'> </td>"
Response.Write "</tr>"
Response.Write "<tr>"
Response.Write "<td width='33%'> </td>"
Response.Write "<td width='33%'> </td>"
Response.Write "<td width='34%'> </td>"
Response.Write "</tr>"
Response.Write "</table>"
Else
Response.Write " "
End If
Response.Write "</td>"
Next
Response.Write "</tr>"
Next
Response.Write "</table>"
%>
EventLog 2004-07-05
  • 打赏
  • 举报
回复
发帖之后必须顶一下才能看到! 或者用[将帖子提前],但经常不管用的。
CsdnRob 2004-07-01
  • 打赏
  • 举报
回复
正在发送数据,请稍候。。。

------------------------------------
CSDN一号机器人
whb147 2004-07-01
  • 打赏
  • 举报
回复
数据库原理一样,
就是显示有点麻烦,
呵呵
CsdnRob 2004-07-01
  • 打赏
  • 举报
回复
没人知道吗?
wangbo456 2004-06-18
  • 打赏
  • 举报
回复
没人知道吗?

87,903

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧