product_list.asp

来自「用ASP写的电子购物系统」· ASP 代码 · 共 164 行

ASP
164
字号
<%@ LANGUAGE = VBScript %>
<!--#INCLUDE FILE="include/manager.asp" -->
<% REM ######################################################################### %>
<% REM                                                                           %>
<% REM   PRODUCT_LIST.ASP                                                        %>
<% REM   Microsoft Commerce Server v3.00                                         %>
<% REM                                                                           %>
<% REM   Copyright (c) 1996-98 Microsoft Corporation.  All rights reserved.      %>
<% REM                                                                           %>
<% REM ######################################################################### %>

<% REM   header: %>
<% pageTitle = "商品列表" %>

<%functionno=2%>
<!--#INCLUDE FILE="checkuser.asp" -->

<HTML>
<HEAD>
    <TITLE> <% = pageTitle %> </TITLE>
    <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=gb2312">
    <LINK REL=stylesheet HREF="manager.css" TYPE="text/css">
    <% stdListRange =15 %>
<BODY TOPMARGIN="0">
<!--#INCLUDE FILE="include/header.asp"--->
<table border="0" width="770" height="423" cellspacing="0" cellpadding="0">
  <tr>
    <td width="140"  valign="top" >
    <!--#INCLUDE FILE = "include/menu.asp" -->
    </td>
    <td width="1" bgcolor="#000000" ></td>
    <td width="600" height="423" align="center" valign="top" class="main">
    <br>


<% REM   query form: %>
<form method="post" name=form1 >
  <table border="0" cellspacing="0" width="46%">
    <tr>
      <td width="24%" class="mainleft">商品编号</td>
      <td width="76%"><input type="text" name="product_no" size="20"></td>
    </tr>
    <tr>
      <td width="24%" class="mainleft">商品名称</td>
      <td width="76%"><input type="text" name="name" size="20"></td>
    </tr>
    <tr>
      <td width="24%" class="mainleft">商品分类</td>
      <TD width="76%" VALIGN=TOP colspan=2>
	      <SELECT NAME="level_id">
	         <option value="0">全部商品</option>
          <%              
             cmdTemp.CommandText = "select * from product_level WHERE parent_id<>0"
             Set rsDept = Server.CreateObject("ADODB.Recordset")
             rsDept.Open cmdTemp, , adOpenKeyset, adLockReadOnly
             If rsDept.RecordCount > 0 Then 
				While Not rsDept.EOF %>
					<option value=<% =rsDept("level_id").Value %>> <% = rsDept("name").Value %>
                    <% rsDept.MoveNext
                Wend
             End If
           %>
           </SELECT>
        </TD>                
    </tr>
    <tr>
      <td width="24%" class="mainleft">价格</td>
      <td width="76%"><input type="text" name="price1" size="8">至<input type="text"
      name="price2" size="8"></td>
    </tr>
  </table>
  <table border="0" cellspacing="0" width="46%">
    <tr>
      <td width="50%"><div align="center"><center><p><input type="submit" value="查询"
      name="Ok"></td>
 <td width="50%"><div align="left"><p><input type="reset" value="重填" name="Cancle"></td>
    </tr>
  </table>
</form>

<% REM   list vars: %>

<%
listElemTemplate = "product_edit.asp"
listElement = "products"

if Request("move")="" or Session("product_sql")="" then
	Dim strSQL,strTemp

	'Product_no
	strSQL=""
	strTemp=Trim(Request.Form("product_no"))
	if strTemp<>"" then
		strSQL=strSQL & "product_no like '" & Replace(strTemp,"'","''") & "%'"	
	end if 

	'product level
	strTemp=Trim(Request.Form("level_id"))
	if strTemp<>"0" and strTemp<>"" then
		if strSQL="" then
			strSQL=strSQL & " level_id='" & strTemp & "'"
		else		
			strSQL=strSQL & " and level_id='" & strTemp & "'"
		end if		
	end if 
	'name
	strTemp=Trim(Request.Form("name"))
	if strTemp<>"" then
		strTemp=Replace(strTemp,"'","''")
		strTemp=" name like '%" & strTemp & "%'"
		if strSQL="" then
			strSQL=strSQL & strTemp
		else		
			strSQL=strSQL & " and " & strTemp 
		end if		
	end if 

	'price
	strTemp= checknum(request("price1"),16)
	if isnull(strtemp) then strTemp=""
	if strTemp<>"" then	
		strTemp=" list_price>= " & strTemp 
		if strSQL="" then
			strSQL=strSQL & strTemp
		else		
			strSQL=strSQL & " and " & strTemp 
		end if		
	end if 

	strTemp= checknum(request("price2"),16)
	if isnull(strtemp) then strTemp=""
	if strTemp<>"" then	
		strTemp=" list_price<= " & strTemp 
		if strSQL="" then
			strSQL=strSQL & strTemp
		else		
			strSQL=strSQL & " and " & strTemp 
		end if		
	end if 

	if strSQL="" then
		strSQL="SELECT * FROM product ORDER BY product_id"
	else
		strSQL="SELECT * FROM product WHERE " & strSQL & " ORDER BY product_id"
	end if
	cmdTemp.CommandText = strSQL
	session("product_sql")=strSQL
else
	cmdTemp.CommandText = session("product_sql")
end if
%>

<%rem =strSQl %>

<% if not(Request("OK")="") or not (Request("move")="") then%>
<!--#INCLUDE FILE="include/list.asp" -->
<%end if%>
</td>
</table>
<% REM   footer: %>

<!--#INCLUDE FILE="include/copyright.asp" -->
</body>
</html>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?