[asp] 无需数据库循环的无级分类代码 [回复2 | 查看:53]

[asp] 无需数据库循环的无级分类代码

<%@LANGUAGE="VBSCRIPT"%>



if exists (select * from dbo.sysobjects where id = object_id(N'.') and OBJECTPROPERTY(id, N'IsUserTable') = 1)

drop table .

GOCREATE TABLE . (

      IDENTITY (1, 1) NOT NULL ,

      (50) COLLATE Chinese_PRC_CI_AS NULL ,

      NULL

) ON

GO



<%

MM_v2boy_STRING = "Driver={Microsoft Access Driver (*.mdb)};DBQ=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 & "" & rsCat__MMColParam

'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

%>

<html>

<head>

<title>&Icirc;&Auml;&micro;&micro;×&Ecirc;&Aacute;&Iuml;</title>

<meta http-equiv="Content-Type" content="text/html; charset=gb2312">

</head>

<body bgcolor="#FFFFFF" text="#000000">

<%

dim request_all

      IF request.querystring <> "" then request_all = "&" & request.querystring

%>



   

    &Icirc;&Auml;&micro;&micro;×&Ecirc;&Aacute;&Iuml;

<%

dim i,j,h

j = Request.QueryString("Cat_Parent").Count

   For i = 1 to j

   'For i = j to 1 step -1

   response.write " j then

                  response.write("&")

        end if

            Next

        'response.write "

"

        response.write ">" & Request.QueryString("Cat_Name")(j-i 1) & " "

    Nextresponse.write "

"While ((Repeat1__numRows <> 0) AND (NOT rsCat.EOF))

%>

      <% If Not rsCat.EOF Or Not rsCat.BOF Then %>

      &Cat_Name=<%=(rsCat.Fields.Item("Cat_Name").Value)%><%=request_all%>"><%=(rsCat.Fields.Item("Cat_Name").Value)%>

      <% End If ' end Not rsCat.EOF Or NOT rsCat.BOF %>

      <%

  Repeat1__index=Repeat1__index 1

  Repeat1__numRows=Repeat1__numRows-1

  rsCat.MoveNext()

Wend

%>

   

  



</body>

</html>

<%

rsCat.Close()

%>

  

如果当初用了正则表达式就不用看到这么眼痛了

TOP

我怀疑楼主用的是金山快译且额外附带了中对中翻译

TOP