📄 usingouterjoin.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 Products.ProductsID,Products.ProductsName,Products.SupplierID,Products.UnitPrice,Suppliers.SupplierName,Suppliers.Phone,Suppliers.Fax,Suppliers.Address FROM Products RIGHT OUTER JOIN Suppliers ON Products.SupplierID=Suppliers.SupplierID WHERE Suppliers.SupplierID = 501"
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语句-OUTER JOIN</title>
</head>
<body>
<div align="center">
<table width="600" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="150">供应商编号</td>
<td width="150">供货商名称</td>
<td width="150">商品名称</td>
<td width="150">单价</td>
</tr>
<%
While ((Repeat1__numRows <> 0) AND (NOT rsProduct.EOF))
%>
<tr>
<td><%=(rsProduct.Fields.Item("SupplierID").Value)%></td>
<td><%=(rsProduct.Fields.Item("SupplierName").Value)%></td>
<td><%=(rsProduct.Fields.Item("ProductsName").Value)%></td>
<td><%=(rsProduct.Fields.Item("UnitPrice").Value)%></td>
</tr>
<%
Repeat1__index=Repeat1__index+1
Repeat1__numRows=Repeat1__numRows-1
rsProduct.MoveNext()
Wend
%>
</table>
<hr>
<p><strong>运用关系型SQL语句-OUTER JOIN,查询某供货商提供的商品。 </strong></p>
</div>
</body>
</html>
<%
rsProduct.Close()
Set rsProduct = Nothing
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -