<%
'**************************************************
'TypeID：大类ID
'作  用：过滤特殊符号
'Call tgzcm_Class_Name(0,"",editid)
'**************************************************
Function tgzcm_Class_Name(TypeID,CompatStr,ID)'递归查询分类
		Dim RSclass,TempStr
		Set RSclass = Conn.Execute("select class_id,class_name,class_dir,class_orderid,class_bigid from tgzcm_class where class_bigid="&TypeID&" order by class_orderid asc" )
		TempStr =CompatStr & "┄"
		Do While Not RSclass.Eof
		if RSclass("class_id")=ID then
				tgzcm_Class_Name = tgzcm_Class_Name & "<option value="""& RSclass("class_id") &""" selected>"
		else
				tgzcm_Class_Name = tgzcm_Class_Name & "<option value="""& RSclass("class_id") &""">"
		end if
				tgzcm_Class_Name = tgzcm_Class_Name & "├" & TempStr &  RSclass("class_name")
				tgzcm_Class_Name = tgzcm_Class_Name & "</option>" & Chr(13) & Chr(10)
				tgzcm_Class_Name = tgzcm_Class_Name &tgzcm_Class_Name(RSclass("class_id"),TempStr,ID)
		RSclass.MoveNext
		loop
		RSclass.Close
		Set RSclass = Nothing
End Function

Sub BigClass()
    '作用:首先查询一级分类
	Set rs = Server.CreateObject("adodb.recordset")
	sql = "select * from tgzcm_class where class_bigid=0 order by class_orderid asc"
	rs.Open sql, Conn, 1, 1
	If rs.bof And rs.eof Then
		Response.Write("<option value=0>没有分类请先添加</option>")
	Else  
		Do while not rs.eof	  
			Response.Write"<option value="&rs("class_id")&">"&rs("class_name")&"</option>"
			Call SmallClass(rs("class_id"))'调用二级	
		rs.movenext  
		Loop
    End If
	rs.Close
	Set rs=nothing
End Sub
Sub SmallClass(sid)
    '作用:递归查询二级分类
	Set rs1 = Server.CreateObject("adodb.recordset")
	sql = "select * from tgzcm_class where class_bigid="&sid&" order by class_orderid asc"
	rs1.Open sql, Conn, 1, 1
	If Not(rs1.bof And rs1.eof) Then
		Do while not rs1.eof
			Response.Write"<option value="&rs1("class_id")&">　|-"&rs1("class_name")&"</option>"
		rs1.movenext  
		loop 
    End If
	rs1.Close
	Set rs1=nothing	
End Sub
%>