| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 747 人关注过本帖
标题:ASP 表格排序
只看楼主 加入收藏
rijowfnh
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2012-12-14
收藏
 问题点数:0 回复次数:0 
ASP 表格排序
程序代码:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="inc/IsLogin.asp" -->
<!--#include file="conn.asp" -->


 <style type="text/css">
    @media print{
    .print{display:block;}
    .nprint{display:none;}
    }
</style>




<%

'=====================================================================

'=====================================================================
dim action
action=request.QueryString("action")
if action="del" then
id=Request.QueryString("id")
set rs=server.createobject("adodb.recordset")
sql="select * from User_Tui where id="&id
rs.open sql,conn,2,3
rs.delete
rs.update
rs.close
set rs=nothing
call closeconn()
response.write "<script language=JavaScript>" & chr(13) & "alert('该订单删除成功!');"&"location.href = 'User_Run.asp'"&" </script>"
Response.end()
end if
%>


 <% 

 set rs=server.createobject("adodb.recordset")
sql="Select * from User_Tui"
if request.Form("Key")<>"" then
    select case request("search")
                case "product"
                sql=sql&" where product like '%"&trim(request.Form("key"))&"%'"
               case "email"
               sql=sql&" where ordernum like '%"&trim(request.Form("key"))&"%'"
               case else
               sql=sql&" where ordernum like '%"&trim(request.Form("key"))&"%' or product like '%"&trim(request.Form("key"))&"%'"
    end select
end if
'未审核订单
if action="nocheck" then
sql=sql&" where check=false"

end if
if action="check" then
sql=sql&" where check=true"

end if

sql=sql&" order by check"


rs.open sql,conn,1,1
if err.number <> 0 then
response.write "数据库操作失败:"&err.description
response.End()
end if

 %>
<html>
<head>
<title>网站后台管理中心</title>
<meta HTTP-EQUIV="Content-Type" content="text/html; charset=gb2312">
<!--#include file="inc/meta.asp" -->
<link rel="stylesheet" type="text/css" href="inc/style.css"></head>
<body bgcolor="#CAD7F7" vlink="#000000">
<table width="95%"  border="0" align="center" cellpadding="3" cellspacing="1">
  <form name="form2" method="post" action="User_run.asp">
    <tr>
      <th height="25" align="center" background="images/admin_bg_1.gif"><span style="color:#FFF">提交订单搜索</span></th>
    </tr>
    <tr>
      <td height="25" align="center">&nbsp; 关键字&nbsp;
          <input name="key" type="text" id="key" size="40" maxlength="20">&nbsp;
        <select name="search" size="1">
          <option value="" selected>请选择搜索分类</option>
          <option value="product" <%if request("search")="product" then%>selected<%end if%>>按产品</option>
          <option value="ordernum" <%if request("search")="ordernum" then%>selected<%end if%>>按订单号</option>
        </select>
        <input type="submit" name="Submit2" value="订单搜索"></td>
    </tr>
  </form>
</table>
<%     

'是否有记录可以查询
if rs.eof and RS.bof then
   If request.Form("key")<>"" then
  response.write "没有相关记录!"
    else
  response.write "没有订单数据!"
end if
call closeconn()
response.End()
end if       

 %>
  <table width="95%" border="1" cellspacing="0" cellpadding="3" align="center" bordercolorlight="#326598" bordercolordark="#ffffff" style="margin-top:10px;">
    <tr >
      <th height="25" colspan="7" align="center" background="images/admin_bg_1.gif">
      <b><font color="ffffff">提交订单管理</font></b></th>
    </tr>
    
    <tr align="center" valign="middle">
      <td width="15%" height="25"><span class="tablebody">订单号</span></td>
     
      <td width="13%">仓库名</td>
     
      <td width="30%" height="25">品名规格</td>
          <td width="13%" height="25">订货数量</td>
   
      <td height="25" colspan="2">管理操作</td>
    </tr>
   

 <%
'分页信息头部
filepath=request.servervariables("path_info")
page=1 '设置变量初始值PAGE=1
page=request.querystring("page") 'page值为接受值
rs.PageSize = 30 '每页显示记录数
if Not IsEmpty(trim(Request("Page"))) then '如果PAGE已经初始化...
Page = CInt(Request("Page")) '接收PAGE并化为数字型赋给PAGE变量
if Page > rs.PageCount then '如果接收的页数大于总页数
rs.AbsolutePage = rs.PageCount '设置当前显示页等于最后页
elseif Page <= 0 then '如果page小于等于0
Page = 1 '设置PAGE等于第一页
else
rs.AbsolutePage = Page '如果大于零,显示当前页等于接收的页数
end if
End if
Page = rs.AbsolutePage
for i = 0 to rs.PageSize
%>
    <tr align="center" valign="middle">
      <td height="25"><a href="User_Modify.asp?id=<%=rs("id")%>" ><%= rs("ordernum") %></a></td>
     
      <td><%= rs("username") %></td>
      <td height="25">    

        <div align="left"><%=rs("product")%></div></td>
   
     <td height="25">   
        <div align="right"><%=rs("mobile")%></div></td>
   
   
      <td width="12%" height="25">
      <% If rs("check")=true Then %>
      已审核订单
      <% Else %>
      <a href="UserCheck.asp?id=<%=rs("id")%>" title="点击审核"><font color="red">未审核订单</font></a>
      <% End If %>      </td>
      <td width="7%"><a onclick='{if(confirm("您确定删除吗?此操作将不能恢复!")){return true;}return false;}' href="User_Run.asp?id=<%=rs("id")%>&action=del">删除</a> </td>
    </tr>
   
    <%
RS.movenext
if RS.eof then
i = i + 1
exit for
End If
next
%>
<tr>
<td colspan="5" >
<div  style="margin:5px auto;text-align:center">
  <form action="<%=filepath%>" method="get">
    <%if rs.pagecount<>1 and rs.pagecount<>0 then%>
    <%if page>1 then%>
    <%if page<rs.pagecount then %>
[<a Href="<%=filepath%>?Page=<% = 1%>&dotest=<%=dotest%>">首页</a>]
    [<a Href="<%=filepath%>?Page=<% = page -1 %>&dotest=<%=dotest%>">上一页</a>]
    [<a Href="<%=filepath%>?Page=<% = page + 1%>&dotest=<%=dotest%>">下一页</a>]
    [<a Href="<%=filepath%>?Page=<% = rs.PageCount%>&dotest=<%=dotest%>">尾页</a>]
    <%else%>
    [<a Href="<%=filepath%>?Page=<% = 1%>&dotest=<%=dotest%>">首页</a>]
    [<a Href="<%=filepath%>?Page=<% = page -1 %>&dotest=<%=dotest%>">上一页</a>]
    [下一页] [尾页]
    <% end if %>
    <%else%>
    [首页] [上一页]
    [<a Href="<%=filepath%>?Page=<% = page + 1%>&dotest=<%=dotest%>">下一页</a>]
    [<a Href="<%=filepath%>?Page=<% = rs.PageCount%>&dotest=<%=dotest%>">尾页</a>]
    <%end if %>
    <%else%>
    [首页] [上一页] [下一页] [尾页]
    <%end if%>
    <!--尾部-->
    [页次:<font color=red><b><%=page%></b></font>/<%=rs.PageCount%>]
    [共<%=rs.RecordCount%><font color=red><b><%=rs.PageSize%></b></font>篇/页]
    转到
    <input name="page" size=5 value="<%=page%>"><input name="submit" type="submit" value="Enter">
    <input id="print" type="button" value="打印" onclick="javascript:window.print();" class="nprint"/>
   
  </form>
</div></td>
</tr>
  </table>

 </form>
</body>
</html>
<%
rs.close
set rs=nothing
Call CloseConn()

 %>

搜索更多相关主题的帖子: 表格 include file 
2012-12-14 20:16
快速回复:ASP 表格排序
数据加载中...
 
   



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

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