asp中response.write " "内部如何写才算正确?
<%setrs1=server.createobject("adodb.recordset")sql1="SELECT*fromBigClass"rs1.opensql1...
<%
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中的内容,多谢! 展开
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中的内容,多谢! 展开
展开全部
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)"
下面这句我看不清你的引号,
SELECT * from SmallClass where BigClassID="&bcid&" and SmallClassID<>''"
但我觉得你可以这样写
SELECT * from SmallClass where BigClassID="&bcid&" and isNull(SmallClassID)"
追问
按照你的方法,最后出现:
An error occurred on the server when processing the URL. Please contact the system administrator.
If you are the system administrator please click here to find out more about this error.
展开全部
<%
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
%>
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
%>
追问
我昨晚试了,只改动循环里的顺序写法是不行的。
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
Response.Write "<a href=../product.asp?bcid='"&bcid&"' title='"&bcname&"' > '"&bcname&"' </a> "
其中没有必要用单引号的地方别乱用。
其中没有必要用单引号的地方别乱用。
更多追问追答
追问
我的写法和你的一样啊
追答
我没写什么啊,只是复制你的引用而已
需要考虑下数据类型,字符开型的还是数值型。
你的SELECT * from SmallClass where BigClassID="&bcid&" and SmallClassID''"
说明BigClassID是数值型,而SmallClassID是字符型吧?看下数据的表中具体情况。
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询