How To Use SQL XML ?

1.Program->Configure SQL XML Support in IIS

How To Use SQL XML ?

2. Create Virtual Directory

How To Use SQL XML ?

-2.1. Fill Virtual Name and Local Path

How To Use SQL XML ?

-2.2 Set Your Database Login User Name and Password

How To Use SQL XML ?

-2.3. Set SQL Server and Database

How To Use SQL XML ?

-2.4 Choice Setting Tab page -> Allow All

How To Use SQL XML ?

-2.5. Set Virtual Name.(Schema and Template in the Virtual Driver are have physics folder, Dbobject not have.)

How To Use SQL XML ?

-2.6 Click OK or Apply ->OK

3. Test SQL XML-> At the IE Address->

1. SQL In IE address

http://localhost/[email protected]@version+as+version+FOR+XML+RAW&root=root

How To Use SQL XML ?

2.XML File In IE address

<?xml version="1.0" encoding="utf-8"?>

<Menu xmlns:sql="urn:schemas-microsoft-com:xml-sql">

<sql:query>

SELECT Menu_ID,Menu_Name,Url,Status

FROM TB_Menu

FOR XML AUTO

</sql:query>

</Menu>

How To Use SQL XML ?

3. Use Style Sheet Display

XML Name: Menu_List.xml

<?xml version="1.0" encoding="utf-8"?>

<?xml-stylesheet type="text/xsl" href="Menu_List.xsl"?>

<Menu xmlns:sql="urn:schemas-microsoft-com:xml-sql">

<sql:query>

SELECT Menu_ID,Menu_Name,Url,Status

FROM TB_Menu

FOR XML AUTO

</sql:query>

</Menu>

How To Use SQL XML ?

XML Style Sheet Name: Menu_List.xsl

<?xml version='1.0' ?>

<xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl">

<xsl:template match="/">

<html>

<head>

<title>Menu List</title>

<base href="http://dg2pc0036/tr_xml/Template/" />

</head>

<body>

<table border="0" cellPadding="1" cellSpacing="1"

width="100%"

style="COLOR:black;FONT-FAMILY:Arial;FONT-SIZE:12pt.;FONT-WEIGHT:500">

<tr bgColor="#336699" align="center">

<TD><P ><STRONG><FONT color="white" size="2">Menu ID:</FONT></STRONG></P></TD>

<TD><P ><STRONG><FONT color="white" size="2">Menu Name:</FONT></STRONG></P></TD>

<TD><P ><STRONG><FONT color="white" size="2">Url:</FONT></STRONG></P></TD>

<TD><P ><STRONG><FONT color="white" size="2">Status:</FONT></STRONG></P></TD>

</tr>

<xsl:for-each select="Menu/TB_Menu">

<tr style="COLOR: black; FONT-FAMILY: Arial; FONT-SIZE: 0.8em; FONT-WEIGHT: 500">

<td bgColor="#F0F0F0"><xsl:value-of select="@Menu_ID"/></td>

<td bgColor="#F0F0F0"><xsl:value-of select="@Menu_Name"/></td>

<td bgColor="#F0F0F0"><xsl:value-of select="@Url"/></td>

<td bgColor="#F0F0F0"><xsl:value-of select="@Status"/></td>

</tr>

</xsl:for-each>

</table>

</body>

</html>

</xsl:template>

</xsl:stylesheet>

相关文章:

  • 2021-12-12
  • 2021-08-24
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-10-23
  • 2021-08-11
  • 2022-12-23
猜你喜欢
  • 2021-06-01
  • 2022-01-04
  • 2021-04-05
  • 2021-04-30
  • 2021-04-15
  • 2021-08-06
相关资源
相似解决方案