Non-level classification code without a database loop

Source: Internet
Author: User
Data | database | loop <% @LANGUAGE = "VBSCRIPT"%>
<!--database Tables
if exists (SELECT * from dbo.sysobjects WHERE id = object_id (N ' [dbo].[ Cat] and OBJECTPROPERTY (ID, N ' isusertable ') = 1)
drop table [dbo]. [Cat]
Go

CREATE TABLE [dbo]. [Cat] (
[CAT_ID] [INT] IDENTITY (1, 1) not NULL,
[Cat_name] [nvarchar] (m) COLLATE chinese_prc_ci_as NULL,
[Cat_parent] [INT] Null
) on [PRIMARY]
Go
-->
<%
mm_v2boy_string = "Driver={microsoft Access Driver (*.mdb)};D Bq=d:\v2boy.mdb"
Dim Rscat__mmcolparam
Rscat__mmcolparam = "1"
if (Request.QueryString ("cat_parent") <> "") Then Rscat__mmcolparam = Request.QueryString ("Cat_parent") (1)
' Response.Write Request.QueryString & ' Response.End
%>
<%
Set rscat = Server.CreateObject ("ADODB. Recordset ")
Rscat.activeconnection = mm_v2boy_string
Rscat.source = "Select cat_id, Cat_name, cat_parent from Cat WHERE cat_parent =" + Replace (Rscat__mmcolparam, "'", "") + ""
Rscat.cursortype = 0
Rscat.cursorlocation = 2
Rscat.locktype = 3
Rscat.open ()
Rscat_numrows = 0
%>
<%
Dim repeat1__numrows
Repeat1__numrows =-1
Dim Repeat1__index
Repeat1__index = 0
Rscat_numrows = rscat_numrows + repeat1__numrows
%>
<title>ÎĵµxÊÁÏ</title>
<meta http-equiv= "Content-type" content= "text/html; charset=gb2312 ">
<body bgcolor= "#FFFFFF" text= "#000000" >
<%
Dim Request_all
IF request.querystring <> "" Then Request_all = "&" & Request.QueryString
%>
<table width= "100%" border= "0" cellspacing= "1" cellpadding= "4" >
<tr>
<td><a href= "data.asp" >ÎĵµxÊÁÏ</a>
<%
Dim i,j,h
j = request.querystring ("Cat_parent"). Count
For i = 1 to J
' For i = j to 1 step-1
Response.Write "<a href=data.asp?"
For h = (j-i + 1) to J
' For h = j to (J-i + 1) step-1
Response.Write "Cat_parent=" & Request.QueryString ("Cat_parent") (h) & "&cat_name=" & Request.QueryString ("Cat_name") (h)
If H <> J then
Response.Write ("&")
End If
Next
' Response.Write ' <br> '
Response.Write ">" & Request.QueryString ("Cat_name") (j-i+1) & "</a>"
Next

Response.Write "<br>"

while ((repeat1__numrows <> 0) and (not rscat.eof))
%>
<% If not rscat.eof Or not rscat.bof Then%>
<a href= "data.asp? cat_parent=<%= (RsCat.Fields.Item ("cat_id"). Value)%>&cat_name=<%= (RsCat.Fields.Item ("Cat_name"). Value)%><%=request_all%> "><%= (RsCat.Fields.Item (" Cat_name "). Value)%></a>
<% End If is not rscat.eof Or not rscat.bof%>
<%
Repeat1__index=repeat1__index+1
Repeat1__numrows=repeat1__numrows-1
Rscat.movenext ()
Wend
%>
</td>
</tr>
</table>
</body>
<%
Rscat.close ()
%>



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.