标题:求助版主或大侠们帮加个【分页和选择框代码】
只看楼主
ningzhonghui
Rank: 2
等 级:论坛游民
帖 子:74
专家分:13
注 册:2010-11-19
结帖率:84.62%
已结贴  问题点数:20 回复次数:4 
求助版主或大侠们帮加个【分页和选择框代码】
<%
if request("action")="edit" then
Dim total
total=Request.Form("total")
Dim j,chinese,math,english,strSql1
For j=1 To total
chinese=Request.Form("chinese" & j)
math=Request.Form("math" & j)
english=Request.Form("english" & j)
strSql1="Update grade Set chinese='" & chinese & "',math='" & math & "',english='" & english & "' Where id=" & Request.Form("id" & j)
db.execute(strSql1)
Next
Response.Redirect "update_form.asp"
end if
%>
<html>
<head>
<title>成绩表</title>
</head>
<body>
<h2 align="center">批量修改成绩表</h2>
<center>
<form action="?action=edit" method="post">
<table border="0" width="90%">
<tr bgcolor="#B7B7B7" align="center">
<td width="20%">学号</td>
<td width="20%">姓名</td>
<td width="20%">语文</td>
<td width="20%">数学</td>
<td width="20%">英语</td>
</tr>
<%
Dim strSql,rs
strSql="Select id,stu_code,stu_name,chinese,math,english From grade Order By stu_code"
Set rs=db.execute(strSql)
Dim I
I=0
Do While Not rs.Eof
I=I+1
%>
<tr bgcolor="#F2F2F2" align="center">
<td><%=rs("stu_code")%></td>
<td><%=rs("stu_name")%></td>
<td>
<input type="hidden" name="id<%=I%>" value="<%=rs("id")%>">
<input type="text" name="chinese<%=I%>" size="5" value="<%=rs("chinese")%>">
</td>
<td>
<input type="text" name="math<%=I%>" size="5" value="<%=rs("math")%>">
</td>
<td>
<input type="text" name="english<%=I%>" size="5" value="<%=rs("english")%>">
</td>
</tr>
<%
rs.MoveNext
Loop
%>
</table>
<P><input type="hidden" name="total" value="<%=I%>">
<input type="submit" value=" 确 定 ">
</form>
</center>
</body>
</html>
搜索更多相关主题的帖子: action request html english 成绩表 
2011-10-25 10:32
yms123
Rank: 16Rank: 16Rank: 16Rank: 16
等 级:版主
威 望:209
帖 子:12488
专家分:19042
注 册:2004-7-17
得分:20 
程序代码:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<!--#include file="CONDB.inc"-->
<!--引用数据库连接文件-->
<%
   '声明数据库记录集对象
   Dim rsano
   '创建数据库记录集对象
   Set rsano=Server.CreateObject("ADODB.Recordset")
   '设定数据库记录集游标类型
   rsano.cursortype=3
   '打开记录集对象
   rsano.Open "select * From ANOUCE ORDER BY AnnounceTheDate DESC",con
   '设定每页显示记录数
   rsano.pagesize=25
   '得到请求的页号
   page=clng(request("page"))
   IF request("page")<>"" then
     page=clng(request("page"))
   Else
     page=1
   End IF
   IF page<1 Then page=1
   If page>rsano.pagecount Then page=rsano.pagecount
   rsano.absolutepage=page

%>
<title>网站公告页面</title>
<!--去除超连接下划线样式表和字体大小设定代码-->
<style type="text/css">
</style>
<STYLE type=text/css>
A {
    TEXT-TRANSFORM: none; TEXT-DECORATION: none
}
UNKNOWN {
    TEXT-DECORATION: underline
}
.style22 {font-size: 12px}
.style16 {font-size: 14px}
BODY {
    background-color: <%=PageStyleT.BackGround%>;
}
</STYLE>
</head>

<BODY>

<table width="294" height="46" border="0" cellspacing="0">
  <tr>
    <td width="338"><div align="center" class="style22">公告标题</div></td>
    <td width="95"><div align="center" class="style22">发布日期</div></td>
  </tr>
  <%
  '定义循环变量
  dim iPage
  For iPage=1 to rsano.Pagesize
   'recno=(page-1)*rsano.pagesize+ipage记录编号计算公式
   Response.Write("<tr>")
     Response.write("<td><span class=style16><a href=announceview.asp?anbh="&rsano.Fields(0).Value&" target=_self>"&rsano.Fields(1).Value&"</a></span></td>")
     Response.Write("<td><span class=style22>"&FormatDateTime(rsano.Fields(4).Value,2)&"</span></td>")
   Response.Write("</tr>")
   rsano.MoveNext
   IF rsano.EOF Then
      Exit For
   End If
  Next
  %>
</table>
<table width="293" border="0">
  <tr>
  <%
  '翻页控制代码
  IF page<>1 Then
    Response.Write("<td><span class=style22><a href=announce.asp?page=1>第一页</a></span></td>")
    Response.Write("<td><span class=style22><a href=announce.asp?page="&(page-1)&">上一页</a></span></td>")
  Else
    Response.Write("<td><span class=style22>第一页</span></td>")
    Response.Write("<td><span class=style22>上一页</span></td>")
  End IF   
  IF page<>rsano.pagecount then
    Response.Write("<td><span class=style22><a href=announce.asp?page=" & (page+1) & ">下一页</a></span></td>")
    Response.Write("<td><span class=style22><a href=announce.asp?page=" & rsano.pagecount & ">最后一页</a></span></td>")
  Else
    Response.Write("<td><span class=style22>下一页</span></td>")
    Response.Write("<td><span class=style22>最后一页</span></td>") 
  End IF
  %>
    <td><span class=style22><%=rsano.pagecount%></span></td>
    <td><span class=style22>当前第<%=page%></span></td>
  </tr>
</table>
<%
'网页对象析构代码
rsano.Close
con.Close
Set rsano=Nothing
Set con=Nothing
%>
</body>
</html>
ASP最简单分页代码给LZ
2011-10-26 12:05
ningzhonghui
Rank: 2
等 级:论坛游民
帖 子:74
专家分:13
注 册:2010-11-19
得分:0 
谢了版主!学习了但还是不知怎么运用到我上面的代码去!望帮写个给我参照,以后有类似的我就学得会运用拉
2011-10-26 12:29
yms123
Rank: 16Rank: 16Rank: 16Rank: 16
等 级:版主
威 望:209
帖 子:12488
专家分:19042
注 册:2004-7-17
得分:0 
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<!--#include file="CONDB.inc"-->
<!--引用数据库连接文件-->
<%
   '声明数据库记录集对象
   Dim rsano
   '创建数据库记录集对象
   Set rsano=Server.CreateObject("ADODB.Recordset")
   '设定数据库记录集游标类型
   rsano.cursortype=3
   '打开记录集对象
   rsano.Open "select * From ANOUCE ORDER BY AnnounceTheDate DESC",con
   'select * From ANOUCE ORDER BY AnnounceTheDate DESC这个SQL语句换成要分页的SQL语句,还有con替换为db
   '设定每页显示记录数
   rsano.pagesize=25
   '得到请求的页号
   page=clng(request("page"))
   IF request("page")<>"" then
     page=clng(request("page"))
   Else
     page=1
   End IF
   IF page<1 Then page=1
   If page>rsano.pagecount Then page=rsano.pagecount
   rsano.absolutepage=page

%>
<title>网站公告页面</title>
<!--去除超连接下划线样式表和字体大小设定代码-->
<style type="text/css">
</style>
<STYLE type=text/css>
A {
    TEXT-TRANSFORM: none; TEXT-DECORATION: none
}
UNKNOWN {
    TEXT-DECORATION: underline
}
.style22 {font-size: 12px}
.style16 {font-size: 14px}
BODY {
    background-color: <%=PageStyleT.BackGround%>;
}
</STYLE>
</head>

<BODY>
<!--这里的HTML代码替换为你的分页HTML代码-->
<table width="294" height="46" border="0" cellspacing="0">
  <tr>
    <td width="338"><div align="center" class="style22">公告标题</div></td>
    <td width="95"><div align="center" class="style22">发布日期</div></td>
  </tr>
  <%
  '定义循环变量
  dim iPage
  For iPage=1 to rsano.Pagesize
   'recno=(page-1)*rsano.pagesize+ipage记录编号计算公式
   
   '同理下面的输出HTML代码一并替换掉
   Response.Write("<tr>")
     Response.write("<td><span class=style16><a href=announceview.asp?anbh="&rsano.Fields(0).Value&" target=_self>"&rsano.Fields(1).Value&"</a></span></td>")
     Response.Write("<td><span class=style22>"&FormatDateTime(rsano.Fields(4).Value,2)&"</span></td>")
   Response.Write("</tr>")

   rsano.MoveNext
   IF rsano.EOF Then
      Exit For
   End If
  Next
  %>
</table>
<table width="293" border="0">
  <tr>
  <%
  '翻页控制代码
  IF page<>1 Then
    Response.Write("<td><span class=style22><a href=announce.asp?page=1>第一页</a></span></td>")
    Response.Write("<td><span class=style22><a href=announce.asp?page="&(page-1)&">上一页</a></span></td>")
  Else
    Response.Write("<td><span class=style22>第一页</span></td>")
    Response.Write("<td><span class=style22>上一页</span></td>")
  End IF   
  IF page<>rsano.pagecount then
    Response.Write("<td><span class=style22><a href=announce.asp?page=" & (page+1) & ">下一页</a></span></td>")
    Response.Write("<td><span class=style22><a href=announce.asp?page=" & rsano.pagecount & ">最后一页</a></span></td>")
  Else
    Response.Write("<td><span class=style22>下一页</span></td>")
    Response.Write("<td><span class=style22>最后一页</span></td>")
  End IF
  %>
    <td><span class=style22>共<%=rsano.pagecount%>页</span></td>
    <td><span class=style22>当前第<%=page%>页</span></td>
  </tr>
</table>
<%
'网页对象析构代码
rsano.Close
con.Close
Set rsano=Nothing
Set con=Nothing
%>
</body>
</html>

2011-10-26 12:50
ningzhonghui
Rank: 2
等 级:论坛游民
帖 子:74
专家分:13
注 册:2010-11-19
得分:0 
回复 4楼 yms123
多谢版主拉我研究了一下午终于修改成功分页的,现还研究加个选择框上去!
2011-10-26 17:29



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-353353-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.399572 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved