你好,请问在asp中response.write " "内部如何写才算正确?

<%
set rs1=server.createobject("adodb.recordset")
sql1 = "SELECT * from BigClass"
rs1.open sql1,conn,1,1
do while not rs1.EOF '大类未结束时循环

bcid = rs1("BigClassID")
bcname = rs1("BigClassName")
Response.Write "<li> <h3 class='mcate-item-hd'>"
Response.Write "<span> "
Response.Write "<a href=../product.asp?bcid='"&bcid&"' title='"&bcname&"' > '"&bcname&"' </a> "
Response.Write "</span></h3> "
rs1.MoveNext
set rs2=server.createobject("adodb.recordset")
sql2 = "SELECT * from SmallClass where BigClassID="&bcid&" and SmallClassID<>"" "
rs2.open sql2,conn,1,1
do while not rs2.EOF '小类未结束时循环

scid = rs2("SmallClassID")
scname = rs2("SmallClassName")
Response.Write "<p class='mcate-item-bd'> "
Response.Write "<a href=../product.asp?bcid='"&bcid&"'&scid='"&scid&"' title='"&scname& "'>'"&scname&"'</a> "
rs2.MoveNext
loop
Response.Write "</p>"
rs2.close
set rs2=nothing
rs1.MoveNext
loop
reponse.write "</li>"
rs1.close
set rs1=nothing
%>
问题:不能读出数据库中的内容并显示!请大家帮助改写,特别是response.write中的内容,多谢!

明月笑刀无情
浏览 204回答 3
3回答

UYOU

Response.Write "<a href=../product.asp?bcid="& bcid &"&title="& bcname &">"& bcname &"</a> "下面这句我看不清你的引号,SELECT * from SmallClass where BigClassID="&bcid&" and SmallClassID<>''"但我觉得你可以这样写SELECT * from SmallClass where BigClassID="&bcid&" and isNull(SmallClassID)"

互换的青春

<%set rs1=server.createobject("adodb.recordset")sql1 = "SELECT * from BigClass"rs1.open sql1,conn,1,1do while not rs1.EOF '大类未结束时循环bcid = rs1("BigClassID")bcname = rs1("BigClassName")Response.Write "<li> <h3 class='mcate-item-hd'>"Response.Write "<span> "Response.Write "<a href=../product.asp?bcid='"&bcid&"' title='"&bcname&"' > '"&bcname&"' </a> "Response.Write "</span></h3></li>"set rs2=server.createobject("adodb.recordset")sql2 = "SELECT * from SmallClass where BigClassID="&bcid&" and SmallClassID<>"" "rs2.open sql2,conn,1,1do while not rs2.EOF '小类未结束时循环scid = rs2("SmallClassID")scname = rs2("SmallClassName")Response.Write "<p class='mcate-item-bd'> "Response.Write "<a href=../product.asp?bcid='"&bcid&"'&scid='"&scid&"' title='"&scname& "'>'"&scname&"'</a> </p>"rs2.MoveNextlooprs2.closeset rs2=nothingrs1.MoveNextlooprs1.closeset rs1=nothing%>

人到中年有点甜

Response.Write "<a href=../product.asp?bcid='"&bcid&"' title='"&bcname&"' > '"&bcname&"' </a> "其中没有必要用单引号的地方别乱用。
打开App,查看更多内容
随时随地看视频慕课网APP