browse.asp

来自「《SQL Server 2000课程设计案例精编》-李昆-源代码-3436」· ASP 代码 · 共 46 行

ASP
46
字号
	<!--#include file="Include/ADOdata.asp" -->

<%

Response.Write RenderCatalog(Request.QueryString("CategoryID"))

Function RenderCatalog(intCategory)
'Function to retrieve products in a specified catalog.

Dim ConDB
Dim cmdProducts
Dim strmResult

'Connect to database
Set conDB = CreateObject("ADODB.Connection")
conDB.Open strCon
Set cmdProducts = CreateObject("ADODB.Command")
Set cmdProducts.ActiveConnection = conDB

'Use the ProductSchema.xml annotated schema
cmdProducts.Dialect = "{ec2a4293-e898-11d2-b1b7-00c04f680c56}" 'XPath Dialect
cmdProducts.Properties("mapping schema") = Server.MapPath("AppFiles\CatalogSchema.xml")
cmdProducts.CommandText = "Catalog/Category/Product[../@CategoryID=" & intCategory & "]" 'XPath for category

'Specify output stream for results
Set strmResult = CreateObject("ADODB.Stream")
strmResult.Open
cmdProducts.Properties("Output Stream") = strmResult

'Specify the root element for the returned document
cmdProducts.Properties("XML Root") = "CatalogData"

'Specify the XSL to be used
cmdProducts.Properties("XSL") = Server.MapPath("AppFiles\Products.xsl")


cmdProducts.Execute , , adExecuteStream
RenderCatalog = strmResult.ReadText

Set strmResult = Nothing
Set cmdProducts = Nothing
Set conDB = Nothing
End Function

%>

⌨️ 快捷键说明

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