asp按条件查询数据库和输出查询结果

2024年12月04日 16:38
有3个网友回答
网友(1):


<%
set rs=Server.CreateObject("ADODB.RecordSet")
sql="select top 20 * from test where username like '%kiming%' order by id desc"
rs.Open sql,conn,1,3
Response.ContentType = "text/xml"
Response.Expires = -1
Response.Write("")
Response.Write("")
Response.Write("")
do while not rs.eof
Response.Write("")
rs.movenext
loop
Response.Write("
")
Response.Write("
")
if Conn.state<>0 then Conn.close
set Conn=nothing
if rs.state<>0 then rs.close
Set rs = Nothing
%>

网友(2):

sql="select top 20 * from test where message like '%kiming%' order by id desc"

网友(3):

sql="select top 20 * from test"