帮忙呀
<%@ Page Language= "VB " ContentType= "text/html " ResponseEncoding= "gb2312 " %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN " "http://www.w3.org/TR/html4/loose.dtd ">
<html>
<head>
<meta http-equiv= "Content-Type " content= "text/html; charset=gb2312 ">
<title> 树型结构 </title>
</head>
<body>
<%
Dim strconn,conn,rs,sql
strconn= "Driver={sql server};server=hanmei;database=book;uid=sa;pwd=hm55336981; "
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 ")
%>
</body>
</html>
以上是我用Dreamweaver 写的一段实现树型结构的代码,可是执行时报错,不知道是什么原因,请帮我看看,报错提示如下:
无法显示 XML 页。
使用 XSL 样式表无法查看 XML 输入。请更正错误然后单击 刷新按钮,或以后重试。
--------------------------------------------
名称以无效字符开头。处理资源 'http://localhost/tree.aspx ' 时出错。第 1 行,位置: 2
<%@ Page Language= "VB " ContentType= "text/html " ResponseEncoding= "gb2312 " %>
-^
------解决方案--------------------我也遇到过,我是重新建一个文件,再把第一行代码重写,其它的代码复制过去
------解决方案--------------------怎么会是xml呢?
关掉id重新打开.
------解决方案--------------------这个文件根本没有执行.你看看客户端的html,
也就是asp.net没有运行.