<!-- create table [dbo].[test] (
-----------[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
[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")
%>
Java Asp PHP .Net XML C/C++ CGI VB Jsp J2ee J2se J2me EJB Servlet Tomcat Resin Struts Weblogic Eclipse ANT GUI JMS Web servise IDEA Webphere Hibernate Spring Jboss Applet Swing Socket Javamail Perl Ajax P2P 安全 模式 框架 测试 开源 游戏
Windows XP Windows 2000 Windows 2003 Windows Me Windows 9.x Linux UNIX 注册表 操作系统 服务器 应用服务器