我无法弄清楚为什么我对此代码没有任何结果:
<Query Name="getClubPoints" RowName="Points">
<SQL>
<![CDATA[
SELECT FirstName, LastName, ClubPoints
FROM Customer
WHERE CustomerID = '78520'
]]>
</SQL>
</Query>
<PackageTransform>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:aspdnsf="urn:aspdnsf" exclude-result-prefixes="aspdnsf">
<xsl:output method="html" omit-xml-declaration="yes"/>
<xsl:template match="/">
<xsl:if test="/root/System/CustomerIsRegistered='true'">
<!--Customer is registered-->
[<xsl:value-of select="/root/System/CustomerID" />] <xsl:value-of select="concat('Welcome, ',/root/System/CustomerFirstName)"/>!<br />
You have [<xsl:value-of select="ClubPoints" />] Club Points
</xsl:if>
</xsl:template>
</xsl:stylesheet>
</PackageTransform>
这个用户(我)有284个俱乐部积分。另外,一旦我完成了这项工作,如何用变量替换78520以获取当前登录的用户的ID?
这将检查运行时参数,并使用当前客户的ID替换SQL查询中的占位符" @customer"。另请参阅:http://manual.aspdotnetstorefront.com/p-157-xml-packages.aspx
<Query Name="getClubPoints" RowName="Points">
<SQL>
<![CDATA[
SELECT FirstName, LastName, ClubPoints
FROM Customer
WHERE CustomerID = @customer
]]>
</SQL>
<queryparam paramname="@customer" paramtype="runtime" requestparamname="CustomerID" sqlDataType="int" defvalue="0" validationpattern="" />
</Query>