acrmbs 2012年11月18日
高分请教一个ASP三级分类显示的问题!
  项目总共有三级分类(区县/乡镇/街道)现在问题是:如果我添加信息的时候,如果选中了第三级"街道",那么其它已添加的信息里没有第三级的也会显示出了第三级街道.同时没有第二级"乡镇"信息的也会显示成我所选中的第二级和第三级分类,这样就成了多个"区县"同一个街道或多个"区县"同一个"乡镇""街道的问题"但是修改和查询时每个数据的分类都是正确的.
如下图:请大家帮忙补一下代码谢谢!


以下是代码:
<%
dim strFileName
const MaxPerPage=20
dim totalPut,CurrentPage,TotalPages
dim i,j
dim ArticleID
dim Title
dim sql,rs
dim BigClassName,SmallClassName
diqu2=trim(request("diqu2"))
jiedao=trim(request("jiedao"))

SmallClassName=trim(request("SmallClassName"))
BigClassName=trim(request("BigClassName"))
if request("page")<>"" then
currentPage=cint(request("page"))
else
currentPage=1
end if
strfilename="laodong_Manage.asp?BigClassName="&BigClassName

if session("fz_qx")="0" then
if SmallClassName="" then
sql="select * from news where ID>0"
else
sql="select * from news where ID>0 and smallclassname='"&smallclassname&"'"
end if
end if
if session("fz_qx")="1" then
if SmallClassName="" then
sql="select * from news where ID>0"
else
sql="select * from news where ID>0 and diqu2='"&smallclassname&"'"
end if
sql=sql & " and SmallClassName='" &session("purview")& "' "
end if
if session("fz_qx")="2" then
if jiedao="" then
sql="select * from news where ID>0"
else
sql="select * from news where ID>0 and jiedao='"&jiedao&"'"
end if
sql=sql & " and diqu2='" &session("diqu2")& "' "
end if

if session("fz_qx")="3" then
if jiedao="" then
sql="select * from news where ID>0"
else
sql="select * from news where ID>0 and jiedao='"&jiedao&"'"
end if
sql=sql & " and jiedao='" &session("jiedao")& "' "
end if


sql=sql & "and BigClassName='" & BigClassName & "' "
sql=sql & " order by id desc"
Set rs= Server.CreateObject("ADODB.Recordset")
rs.open sql,conn,1,1
%>




<form name="del" method="Post" action="laodong_Del.asp" onSubmit="return ConfirmDel();">
<table width="800" border="0" cellpadding="0" cellspacing="1" bgcolor="#000000">
<tr bgcolor="#A4B6D7">
<td height="25" bgcolor="#FFFFFF">
<%
if request.querystring="" then
response.write "所有信息"
else
if request("Query")<>"" then
if Title<>"" then
response.write "名称中含有“<font color=blue>" & Title & "</font>”的信息"
else
response.Write("所有信息")
end if
else
if BigClassName<>"" then
response.write "<a href='laodong_Manage.asp?BigClassName=" & BigClassName & "'>" & BigClassName & "</a> "
if SmallClassName<>"" then
response.write "<a href='laodong_Manage.asp?BigClassName=" & BigClassName & "&SmallClassName=" & SmallClassName & "'>" & SmallClassName & "</a>"
else
response.write " "
end if
end if
end if
end if
%> </td>
<td width="150" bgcolor="#FFFFFF"> 
<%
if rs.eof and rs.bof then
response.write "共找有 0 条信息</td></tr></table>"
else
totalPut=rs.recordcount
if currentpage<1 then
currentpage=1
end if
if (currentpage-1)*MaxPerPage>totalput then
if (totalPut mod MaxPerPage)=0 then
currentpage= totalPut \ MaxPerPage
else
currentpage= totalPut \ MaxPerPage + 1
end if

end if
response.Write "共找到 " & totalPut & " 条信息"
%> </td>
</tr>
</table>
<%
if currentPage=1 then
showContent
showpage strFileName,totalput,MaxPerPage,true,false,"条信息"
else
if (currentPage-1)*MaxPerPage<totalPut then
rs.move (currentPage-1)*MaxPerPage
dim bookmark
bookmark=rs.bookmark
showContent
showpage strFileName,totalput,MaxPerPage,true,false,"条信息"
else
currentPage=1
showContent
showpage strFileName,totalput,MaxPerPage,true,false,"条信息"
end if
end if
end if
%>
<%
sub showContent
dim i
i=0
%>
<table width="800" border="0" cellpadding="0" cellspacing="1" bgcolor="#000000" class="border" style="word-break:break-all">
<tr bgcolor="#A4B6D7" class="title">
<td width="48" height="25" align="center" bgcolor="#ECF5FF">选中</td>
<td width="60" height="25" align="center" bgcolor="#ECF5FF">职工姓名</td>

<td width="146" align="center" bgcolor="#ECF5FF" ><font color="#FF0000">所属乡镇/街道</font></td>
<td width="74" align="center" bgcolor="#ECF5FF" >操作</td>
</tr>
<%do while not rs.eof%>
<tr class="tdbg">
<td width="48" height="22" align="center" bgcolor="#FFFFFF">
<input name='ID' type='checkbox' onClick="unselectall()" id="ID" value='<%=cstr(rs("ID"))%>'>
</td>
<td width="60" align="center" bgcolor="#FFFFFF"><a href="laodong_modi.asp?ID=<%=rs("id")%>"><%=rs("title")%></a></td>

<td align="center" bgcolor="#FFFFFF">
<%

fzsql="select pf_name from pf_products_category where id="&rs("SmallClassName")
set fzrs=server.createobject("adodb.recordset")
fzrs.open fzsql,conn,1,1
if not fzrs.eof then
xian=fzrs("pf_name")
end if
fzrs.close
set fzrs=nothing
fzsql="select pf_name from pf_products_category where id="&rs("diqu2")
set fzrs=server.createobject("adodb.recordset")
fzrs.open fzsql,conn,1,1
if not fzrs.eof then
xiang=fzrs("pf_name")
end if
fzrs.close
set fzrs=nothing
fzsql="select pf_name from pf_products_category where id="&rs("jiedao")
set fzrs=server.createobject("adodb.recordset")
fzrs.open fzsql,conn,1,1
if not fzrs.eof then
jiedao2=fzrs("pf_name")
end if
fzrs.close
set fzrs=nothing

response.Write "<font color=""#ff0000"">"&xian&"</font>/<font color=""blue"">"&xiang&"</font>/<font color=""green"">"&jiedao2&"</font>"
%>



</td>
<td width="74" align="center" bgcolor="#FFFFFF"><a href="laodong_modi.asp?ID=<%=rs("id")%>"> 修改</a>  <a href="laodong_Del.asp?ID=<%=rs("ID")%>&Action=Del" onClick="return ConfirmDel();">删除</a> </td>
</tr>
<%
i=i+1
if i>=MaxPerPage then exit do
rs.movenext
loop
%>
</table>



<table width="800" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="250" height="30"><input name="chkAll" type="checkbox" id="chkAll" onclick=CheckAll(this.form) value="checkbox">
选中本页显示的所有信息</td>
<td><input name="submit" type='submit' value='删除选定的信息'>
<input name="Action" type="hidden" id="Action" value="Del"></td>
</tr>
</table>
<%
end sub
%>
</form>
</td>
</tr>
</table>
<%
rs.close
set rs=nothing
call CloseConn()
%>
...全文
117 点赞 收藏 3
写回复
3 条回复

还没有回复,快来抢沙发~

发动态
发帖子
ASP
创建于2007-09-28

1.9w+

社区成员

35.7w+

社区内容

ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区公告
暂无公告