⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 usingunion.asp

📁 25175 教师工资管理系统 v2.01 由25175学生成绩管理系统 v2.10 修改而成
💻 ASP
字号:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="Connections/conn.asp" -->
<%
Dim rsProduct
Dim rsProduct_numRows

Set rsProduct = Server.CreateObject("ADODB.Recordset")
rsProduct.ActiveConnection = MM_conn_STRING
rsProduct.Source = "select ProductsName,SupplierID,UnitPrice,   '价格低于1000的商品' AS Condition   FROM Products   WHERE UnitPrice<1000   UNION   SELECT ProductsName,SupplierID,UnitPrice,  '供货商ID等于501'AS Condition   from Products   where SupplierID=501   order by Condition   "
rsProduct.CursorType = 0
rsProduct.CursorLocation = 2
rsProduct.LockType = 1
rsProduct.Open()

rsProduct_numRows = 0
%>
<%
Dim Repeat1__numRows
Dim Repeat1__index

Repeat1__numRows = -1
Repeat1__index = 0
rsProduct_numRows = rsProduct_numRows + Repeat1__numRows
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>关系型SQL语句-UNION</title>
</head>

<body>
<div align="center"> 
  <table width="600" border="0" align="center" cellpadding="0" cellspacing="0">
    <tr> 
      <td width="150">商品名称</td>
      <td width="150">供货商编号</td>
      <td width="100">单价</td>
      <td width="200">说明</td>
    </tr>
    <% 
While ((Repeat1__numRows <> 0) AND (NOT rsProduct.EOF)) 
%>
    <tr> 
      <td><%=(rsProduct.Fields.Item("ProductsName").Value)%></td>
      <td><%=(rsProduct.Fields.Item("SupplierID").Value)%></td>
      <td><%=(rsProduct.Fields.Item("UnitPrice").Value)%></td>
      <td><%=(rsProduct.Fields.Item("Condition").Value)%></td>
    </tr>
    <% 
  Repeat1__index=Repeat1__index+1
  Repeat1__numRows=Repeat1__numRows-1
  rsProduct.MoveNext()
Wend
%>
  </table>
  
  <hr>
  <p><strong>运用关系型SQL语句-UNION,</strong></p>
  <p><strong>查询价格低于1000的商品和供应商ID等于501的商品</strong> </p>
</div>
</body>
</html>
<%
rsProduct.Close()
Set rsProduct = Nothing
%>

⌨️ 快捷键说明

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