天枫庄资源网 Design By www.wosibo.com
蛙蛙推荐:asp实现树型结构 选择自 onlytiancai 的 Blog
关键字 蛙蛙推荐:asp实现树型结构
出处
<!--
-----------[test]表生成脚本---------------
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[test]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[test]
GO
CREATE TABLE [dbo].[test] (
[id] [int] IDENTITY (1, 1) NOT NULL ,
[str_note] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
[father_id] [int] NULL
) ON [PRIMARY]
GO
-->
<!--
***********************测试数据********************
[id][str_note][father_id]
[1][电脑书籍][0]
[2][软件开发][1]
[3][硬件维修][1]
[4][asp][2]
[5][php][2]
[6][jsp][2]
[7][html][2]
[8][显示器维修][3]
[9][主板维修][3]
[10][显卡维修][3]
[11][vbs基础][4]
[12][html基础][4]
[13][ado基础][4]
[14][do语句][11]
[15][for语句][11]
[16][select语句][11]
***************************************************
-->
<%
Dim strconn,conn,rs,sql
strconn="Driver={sql server};server=localhost;database=wawavote;uid=sa;pwd=sa;"
Dim i
i=0
Function ShowTree(parentID)
i=i+1
Dim rs
Set rs = Server.CreateObject("ADODB.RecordSet")
sql="SELECT id, str_note, father_id,(SELECT str_note FROM test t2 WHERE t2.id = t1.father_id) AS ParentName FROM test t1 WHERE t1.father_id="&Cint(parentID)
rs.open sql,strconn,1,1
Do While Not rs.Eof
for j=1 to i
Response.Write("---")
next
Response.Write(rs(1)&"["&rs(3)&"]<br>")
ShowTree rs(0)
i=i-1
rs.Movenext
Loop
rs.Close:Set rs=Nothing
End Function
Sub ShowTable(table)
Dim rs
Set rs = Server.CreateObject("ADODB.RecordSet")
sql="select * from "&trim(table)
rs.open sql,strconn,1,1
For i=0 To rs.Fields.Count-1
Response.Write("["&rs.fields(i).Name&"]")
next
Response.Write("<br>")
Do While Not rs.Eof
For i=0 To rs.Fields.Count-1
Response.Write("["&rs.fields(i).Value&"]")
next
Response.Write("<br>")
rs.MoveNext
Loop
rs.Close:Set rs=Nothing
End sub
ShowTree(0)
ShowTable("test")
%>
关键字 蛙蛙推荐:asp实现树型结构
出处
<!--
-----------[test]表生成脚本---------------
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[test]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[test]
GO
CREATE TABLE [dbo].[test] (
[id] [int] IDENTITY (1, 1) NOT NULL ,
[str_note] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
[father_id] [int] NULL
) ON [PRIMARY]
GO
-->
<!--
***********************测试数据********************
[id][str_note][father_id]
[1][电脑书籍][0]
[2][软件开发][1]
[3][硬件维修][1]
[4][asp][2]
[5][php][2]
[6][jsp][2]
[7][html][2]
[8][显示器维修][3]
[9][主板维修][3]
[10][显卡维修][3]
[11][vbs基础][4]
[12][html基础][4]
[13][ado基础][4]
[14][do语句][11]
[15][for语句][11]
[16][select语句][11]
***************************************************
-->
<%
Dim strconn,conn,rs,sql
strconn="Driver={sql server};server=localhost;database=wawavote;uid=sa;pwd=sa;"
Dim i
i=0
Function ShowTree(parentID)
i=i+1
Dim rs
Set rs = Server.CreateObject("ADODB.RecordSet")
sql="SELECT id, str_note, father_id,(SELECT str_note FROM test t2 WHERE t2.id = t1.father_id) AS ParentName FROM test t1 WHERE t1.father_id="&Cint(parentID)
rs.open sql,strconn,1,1
Do While Not rs.Eof
for j=1 to i
Response.Write("---")
next
Response.Write(rs(1)&"["&rs(3)&"]<br>")
ShowTree rs(0)
i=i-1
rs.Movenext
Loop
rs.Close:Set rs=Nothing
End Function
Sub ShowTable(table)
Dim rs
Set rs = Server.CreateObject("ADODB.RecordSet")
sql="select * from "&trim(table)
rs.open sql,strconn,1,1
For i=0 To rs.Fields.Count-1
Response.Write("["&rs.fields(i).Name&"]")
next
Response.Write("<br>")
Do While Not rs.Eof
For i=0 To rs.Fields.Count-1
Response.Write("["&rs.fields(i).Value&"]")
next
Response.Write("<br>")
rs.MoveNext
Loop
rs.Close:Set rs=Nothing
End sub
ShowTree(0)
ShowTable("test")
%>
标签:
asp实现树型结构
天枫庄资源网 Design By www.wosibo.com
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
天枫庄资源网 Design By www.wosibo.com
暂无asp实现树型结构的评论...
更新日志
2024年12月25日
2024年12月25日
- 小骆驼-《草原狼2(蓝光CD)》[原抓WAV+CUE]
- 群星《欢迎来到我身边 电影原声专辑》[320K/MP3][105.02MB]
- 群星《欢迎来到我身边 电影原声专辑》[FLAC/分轨][480.9MB]
- 雷婷《梦里蓝天HQⅡ》 2023头版限量编号低速原抓[WAV+CUE][463M]
- 群星《2024好听新歌42》AI调整音效【WAV分轨】
- 王思雨-《思念陪着鸿雁飞》WAV
- 王思雨《喜马拉雅HQ》头版限量编号[WAV+CUE]
- 李健《无时无刻》[WAV+CUE][590M]
- 陈奕迅《酝酿》[WAV分轨][502M]
- 卓依婷《化蝶》2CD[WAV+CUE][1.1G]
- 群星《吉他王(黑胶CD)》[WAV+CUE]
- 齐秦《穿乐(穿越)》[WAV+CUE]
- 发烧珍品《数位CD音响测试-动向效果(九)》【WAV+CUE】
- 邝美云《邝美云精装歌集》[DSF][1.6G]
- 吕方《爱一回伤一回》[WAV+CUE][454M]