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

📄 usingrsjoin.asp

📁 25175 教师工资管理系统 v2.01 由25175学生成绩管理系统 v2.10 修改而成
💻 ASP
字号:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="Connections/conn.asp" -->
<%
Dim rsSuppliers__MMColParam
rsSuppliers__MMColParam = "1"
If (Request.Form("SupplierID") <> "") Then 
  rsSuppliers__MMColParam = Request.Form("SupplierID")
End If
%>
<%
Dim rsSuppliers
Dim rsSuppliers_numRows

Set rsSuppliers = Server.CreateObject("ADODB.Recordset")
rsSuppliers.ActiveConnection = MM_conn_STRING
rsSuppliers.Source = "SELECT * FROM Suppliers WHERE SupplierID = " + Replace(rsSuppliers__MMColParam, "'", "''") + ""
rsSuppliers.CursorType = 0
rsSuppliers.CursorLocation = 2
rsSuppliers.LockType = 1
rsSuppliers.Open()

rsSuppliers_numRows = 0
%>
<%
Dim rsProduct__MMColParam
rsProduct__MMColParam = "1"
If (Request.Form("SupplierID") <> "") Then 
  rsProduct__MMColParam = Request.Form("SupplierID")
End If
%>
<%
Dim rsProduct
Dim rsProduct_numRows

Set rsProduct = Server.CreateObject("ADODB.Recordset")
rsProduct.ActiveConnection = MM_conn_STRING
rsProduct.Source = "SELECT * FROM Products WHERE SupplierID = " + Replace(rsProduct__MMColParam, "'", "''") + ""
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>多重记录集实例</title>
</head>

<body>
<form name="form1" method="post" action="">
  
  
  <div align="center">供货商编号: 
    <input name="SupplierID" type="text" id="SupplierID">
    <input type="submit" name="Submit" value="提交">
  </div>
</form>


<% If Not rsSuppliers.EOF Or Not rsSuppliers.BOF Then %>
<table width="500" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr> 
    <td width="200"> <div align="center">供货商编号</div></td>
    <td width="300"><%=(rsSuppliers.Fields.Item("SupplierID").Value)%></td>
  </tr>
  <tr> 
    <td> <div align="center">供货商名称</div></td>
    <td><%=(rsSuppliers.Fields.Item("SupplierName").Value)%></td>
  </tr>
  <tr> 
    <td> <div align="center">供货商电话</div></td>
    <td><%=(rsSuppliers.Fields.Item("Phone").Value)%></td>
  </tr>
  <tr> 
    <td> <div align="center">供货商地址</div></td>
    <td><%=(rsSuppliers.Fields.Item("Address").Value)%></td>
  </tr>
</table>
<hr>
<% End If ' end Not rsSuppliers.EOF Or NOT rsSuppliers.BOF %>
<div align="center"> 
  <% If Not rsProduct.EOF Or Not rsProduct.BOF Then %>
  <table width="600" border="0" cellspacing="0" cellpadding="0">
    <tr> 
      <td width="200"> <div align="center">商品编号</div></td>
      <td width="200"> <div align="center">商品名称</div></td>
      <td width="200"> <div align="center">单价</div></td>
    </tr>
    <% 
While ((Repeat1__numRows <> 0) AND (NOT rsProduct.EOF)) 
%>
    <tr> 
      <td> 
        <div align="center"><%=(rsProduct.Fields.Item("ProductsID").Value)%></div></td>
      <td> 
        <div align="center"><%=(rsProduct.Fields.Item("ProductsName").Value)%></div></td>
      <td> 
        <div align="center"><%=(rsProduct.Fields.Item("UnitPrice").Value)%></div></td>
    </tr>
    <% 
  Repeat1__index=Repeat1__index+1
  Repeat1__numRows=Repeat1__numRows-1
  rsProduct.MoveNext()
Wend
%>
  </table>
  <% End If ' end Not rsProduct.EOF Or NOT rsProduct.BOF %>
</div>
<% If rsSuppliers.EOF And rsSuppliers.BOF Then %>
<p align="center"><strong>查无相关记录</strong></p>
<% End If ' end rsSuppliers.EOF And rsSuppliers.BOF %>
<hr>
<p align="center"><strong>运用2个记录集实现关系型SQL语句的效果,</strong></p>
<p align="center"><strong>查询某供货商信息及供货商供应的产品</strong></p>
</body>
</html>
<%
rsSuppliers.Close()
Set rsSuppliers = Nothing
%>
<%
rsProduct.Close()
Set rsProduct = Nothing
%>

⌨️ 快捷键说明

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