ASP获取集合

来源:百度知道 编辑:UC知道 时间:2024/05/12 01:18:27
select id from table where name like '%奥运%'
怎么只能获取一个ID,不是一个集合吗,哪位达人指点一下。
不好意思,各位,是我的浏览器问题,呵呵.给谁分呢.

select选出来的本来就全是集合啊,只可能是你满足条件的只那一个吧

满足条件的只有一个

<%
set rs=server.CreateObject("adodb.recordset")
sql="select id from table where name like '%奥运%'"
rs.open sql,conn,1,3

if rs.bof and rs.eof then
response.write "<tr><td colspan='6'><div align='center'>没有信息</div></td></tr>"
else
while not rs.eof

response.Write(rs("id"))

rs.movenext
wend
end if
rs.close
%>

如果只有1条,那么是满足条件的只有那一个