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

asp语句不能显示记录,但可以循环

guaishi 发布于 2007-09-24 11:42, 626 次点击


<!--#include file="../include/Config.asp"-->
<!--#include file="check_login.asp"-->

<body>
<% set rs=server.CreateObject("adodb.recordset")
sql="select * from corpuser_info order by username desc"
rs.open sql,conn,2,3
%>
<form id="form1" name="form1" method="post" action="">
<table width="762" border="1">
<tr>
<td width="289"><span class="STYLE3">用户名</span><span class="STYLE1">(username)</span></td>
<td width="263"><span class="STYLE7">logo信息</span></td>
<td width="188"><span class="STYLE4">管理</span></td>
</tr>
<%do while not rs.eof and rs.bof%>
<tr>
<td><%=rs("username")%></td>
<td><%=rs("logo")%></td>
<td><a href="zhenzhi_log.asp?username=<%=rs("username")%>&act="显示" target="_self" class="STYLE4">显示</a><span class="STYLE4">/</span><a href="zhenzhi_log.asp?username=<%rs("username")%>&act=“不显示" target="_self" class="STYLE4">不显示</a></td>
</tr>
<%rs.movenext%>
<%loop%>
</table>
</form>

<% act=request.querystring("act")
username=request.querystring("username")
set rb=server.createobject("adodb.recordset")
sql="select * from corpuser_info where username='"&username&"' "
rb.open sql,conn,2,3
if act="显示" then
rb("logo")=1
else
rb("logo")=0
rb.update
rb.close
set rb=nothing
conn.close
set conn=nothing
end if
%>
</body>
</html>

只有本站会员才能查看附件,请 登录

[此贴子已经被作者于2007-9-24 11:49:09编辑过]

7 回复
#2
天涯听雨2007-09-24 14:10
为什么这样的循环一定要建立记录呢,写简单一些不好吗?

set rs=conn.exeCute("select * from corpuser_info order by username desc")

do while not rs.eof

……………………

rs.movenext
loop

rs.close
#3
yms1232007-09-24 14:18

<!--#include file="../include/Config.asp"-->
<!--#include file="check_login.asp"-->

<body>
<% set rs=server.CreateObject("adodb.recordset")
sql="select * from corpuser_info order by username desc"
rs.open sql,conn,2,3
%>
<form id="form1" name="form1" method="post" action="">
<table width="762" border="1">
<tr>
<td width="289"><span class="STYLE3">用户名</span><span class="STYLE1">(username)</span></td>
<td width="263"><span class="STYLE7">logo信息</span></td>
<td width="188"><span class="STYLE4">管理</span></td>
</tr>
<%do while not rs.eof and rs.bof%>
<tr>
<td><%=rs("username")%></td>
<td><%=rs("logo")%></td>
<td><a href="zhenzhi_log.asp?username=<%=rs("username")%>&act="显示" target="_self" class="STYLE4">显示</a><span class="STYLE4">/</span><a href="zhenzhi_log.asp?username=<%rs("username")%>&act=“不显示" target="_self" class="STYLE4">不显示</a></td>
</tr>
<%rs.movenext%>
<%loop%>
</table>
</form>

<%
act=request.querystring("act")
username=request.querystring("username")
set rb=server.createobject("adodb.recordset")
sql="select * from corpuser_info where username='"&username&"' "
rb.open sql,conn,2,3
if act="显示" then
rb("logo")=1
else
rb("logo")=0
rb.update
rb.close
set rb=nothing
conn.close
set conn=nothing
end if
%>
</body>
</html>

URL尽量使用英文传送。

#4
guaishi2007-09-25 09:40

这是不是和空间有关系呢
现在网站读不了数据库了
好怪

#5
guaishi2007-09-25 11:41
回复:(guaishi)asp语句不能显示记录,但可以循环

<!--#include file="../include/db.asp"-->
<!--#include file="check_login.asp"-->
<% set rs=server.CreateObject("adodb.recordset")
sql = "select * from corpuser_info "
rs1.open sql,conn,1,1
%>
<table width="469" border="1">
<tr>
<td width="138"><span class="STYLE5">用户名(username</span><span class="STYLE5">)</span></td>
<td width="189"><span class="STYLE5">是否显示logo</span></td>
<td width="120"><span class="STYLE1 STYLE5"><strong>管理</strong></span></td>
</tr>
<% do while not rs.eof%>
<tr>
<td><%=rs(2)%></td>
<td><%=rs(115)%></td>
<td><a href="zhenzhilogo.asp?username=<%=rs(2)%>">修改</a></td>
</tr>
<%rs.movenext%>
<%loop%>
</table>








<!--#include file="../include/Config.asp"-->
<!--#include file="check_login.asp"-->

<body>
<form action="zhenzhiadd.asp" method="get">
<table width="584" border="1">
<tr>
<td width="185"><label><span class="STYLE3 STYLE2">用户名</span><span class="STYLE2 STYLE1">(username)</span></label></td>
<td width="168"><span class="STYLE5 STYLE1">加框是否</span></td>
<td width="209" rowspan="2"><label>
<input name="Submit" type="submit" class="STYLE2" value="更新" />
</label></td>
</tr>
<tr>
<td><label>
<input name="username" type="text" value="<%=rs(2)%>" />
</label></td>
<td><label>
<input name="payment" type="text" value="<%=rs(114)%>" />
</label></td>
</tr>
</table>

</form>
<% username=request.QueryString("username")
%>
<% set rs=server.CreateObject("adodb.recordset")
sql="select * from corpuser_info where username='"&username&"'"
rs.open sql,conn,2,3%>
<%rs.addnew
rs(2)=request.form("username")
rs(114)=request.Form("payment")
rs.update
rs.close
set rs=nothing
%>

#6
yms1232007-09-25 11:45
楼主的网站现在在服务器上还是本机上?
#7
中国男孩2007-09-25 13:05
回复:(yms123)楼主的网站现在在服务器上还是本机上...
你可以用试一下

For i=rs.recordset

rs.movenext
next
#8
guaishi2007-09-26 00:17

在服务器上,现在处理好了

1