姓包的男孩名字大全集:ASP的一个简单问题.

来源:百度文库 编辑:中科新闻网 时间:2024/05/01 07:56:33
两个都一起读取数据库中的ID 1里面的数据, 2 3...的都读取不到.
要加什么代码 能让他 按顺序的读取呢?
<!--#include file="conn.asp"-->
<%
Dim Sql,rs
Dim xm,xb,sr
sql="select xm,xb,sr,id from [user]"
set rs=Server.CreateObject("ADODB.Recordset")
Call OpenConn()'打开数据连接
rs.open sql,conn,1,1
if rs.bof and rs.eof then'如果记录为空(提示错误)
response.write "没有找到任何数据记录"
response.end
else
xm=rs("xm")
xb=rs("xb")
sr=rs("sr")
end if
'关闭数据库连接
Call CloseConn()
%>
<html>
<body>
<p>姓名:<%=xm%></p>
<p>性别:<%=xb%></p>
<p>生日:<%=sr%></p>

<p>姓名:<%=xm%></p>
<p>性别:<%=xb%></p>
<p>生日:<%=sr%></p>
</body>
</html>
留下QQ..

<!--#include file="conn.asp"-->
<%
Dim Sql,rs
Dim xm,xb,sr
sql="select xm,xb,sr,id from [user]"
set rs=Server.CreateObject("ADODB.Recordset")
Call OpenConn()'打开数据连接
rs.open sql,conn,1,1
%>
<html>
<body>
<%
if rs.bof and rs.eof then'如果记录为空(提示错误)
response.write "没有找到任何数据记录"
response.end
else
do while not rs.eof
xm=rs("xm")
xb=rs("xb")
sr=rs("sr")
%>
<p>姓名:<%=xm%></p>
<p>性别:<%=xb%></p>
<p>生日:<%=sr%></p>
<%
rs.movenext
loop
end if
'关闭数据库连接
Call CloseConn()
%>
</body>
</html>