谁能帮我找个数据库while循环语句的实例啊?

来源:百度知道 编辑:UC知道 时间:2024/06/01 04:20:27
我要找一个数据库while循环语句的实例.
比如这样的:今有鸡兔同笼,共有35个头,94只脚,问鸡和兔各有几只?
declare @x int, @y int
• set @x=1
• while @x<=35
• begin
• set @y=1
• while @y<=35-@x
• begin
• if 2*@x+4*@y=94 and @x+@y=35
• print str(@x)+str(@y)
• set @y=@y+1
• end
• set @x=@x+1
• end
• 结果:23只鸡 12只兔子

<%Set rs1 = Server.CreateObject ("ADODB.Recordset")
delsql="select top 10 * from [tm_news] where classid1=55 order by ontop desc,date desc"
rs1.Open delsql,conn,3,1
if not rs1.eof then
do while not rs1.eof%>
<li><a href="/news.asp?id=<%=rs1("id")%>" title="<%=rs1("name")%>"><span style="<%=news_style%>"><%=left(rs1("name"),29)%></span></a></li>
<%
rs1.movenext
loop
else
response.write "n/a"
end if
rs1.close
set rs1=nothing
%>

到这看看,希望能帮到你。