为了账号安全,请及时绑定邮箱和手机立即绑定

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

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

明月笑刀无情 2022-04-08 11:07:37
<%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> "rs1.MoveNextset 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> "rs2.MoveNextloopResponse.Write "</p>"rs2.closeset rs2=nothingrs1.MoveNextloopreponse.write "</li>"rs1.closeset rs1=nothing%>问题:不能读出数据库中的内容并显示!请大家帮助改写,特别是response.write中的内容,多谢!
查看完整描述

3 回答

?
UYOU

TA贡献1878条经验 获得超4个赞

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)"

查看完整回答
反对 回复 2022-04-11
?
互换的青春

TA贡献1797条经验 获得超6个赞

<%
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></li>"
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> </p>"
rs2.MoveNext
loop
rs2.close
set rs2=nothing
rs1.MoveNext
loop
rs1.close
set rs1=nothing
%>



查看完整回答
反对 回复 2022-04-11
?
人到中年有点甜

TA贡献1895条经验 获得超7个赞

Response.Write "<a href=../product.asp?bcid='"&bcid&"' title='"&bcname&"' > '"&bcname&"' </a> "
其中没有必要用单引号的地方别乱用。

查看完整回答
反对 回复 2022-04-11
  • 3 回答
  • 0 关注
  • 203 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信