注册 登录
编程论坛 ASP技术论坛

asp查询Excel数据结果自动编号问题

sncelpl 发布于 2022-02-28 10:06, 1079 次点击
<%
str=NoCSSHack(left(FormatHTML(Server.HTMLEnCode(request("q"))),50))

if str="" then
response.write "请输入关键词。"
else
for i=1 to len(str)
if i<>len(str) then
sql=sql&"题目内容 not like '%"&str&"%' and 题目内容 like '%"&mid(str,i,2)&"%' or "
else
sql=sql&"答案 like '%"&str&"%' and 题目内容 not like '%"&str&"%'"
end if
next
set rs=server.createobject("adodb.recordset")
sql="select *,1 from [Sheet1$] where 题目内容 like '%"&str&"%'or 题型 like '%"&str&"%'"
rs.open sql,conn,1,1
if rs.eof then
Response.Write "没有搜索到内容。"
else
do while not rs.eof
Response.Write "[&nbsp;"
response.write "<font color=red>" & rs("题型") & "</font>"
Response.Write "&nbsp;]&nbsp;[&nbsp;"
Response.Write "答案&nbsp;"
response.write "<font color=red>" & rs("答案") & "</font>"
Response.Write "&nbsp;]&nbsp;&nbsp;"
Response.Write rs("题目内容")
Response.Write rs("选项A")

Response.Write rs("选项B")

Response.Write rs("选项C")

Response.Write rs("选项D")

Response.Write rs("选项E")
'Response.Write "&nbsp;"

Response.Write "<br>"
rs.movenext
loop
end if
rs.close
end if
%>

怎么在查询结果前生成编号如:查询"中国"

1、中国...

2、...中国..

3、中国
2 回复
#2
sncelpl2022-03-01 09:52
怎么没有人啊
#3
sncelpl2022-03-02 12:34
已解决
1