Summary

In this chapter, we've discussed the use of ADO to access XML data in a SQL Server database. The key to retrieving XML is to submit queries in the form of an XML document based on the Microsoft XML-SQL namespace. The inbound document should include one or more sql:query elements containing a FOR XML query (or a call to a stored procedure containing a FOR XML query).

In most circumstances, you should use a Stream object for both the inbound query document and the outbound results, although you can set the Dialect property to the MSSQLXML_DIALECT GUID and use the CommandText property for the inbound query.

You can apply a style sheet to the results by setting the XSL property of the Command object and using this object's Base Path and SS Stream Flags properties to control how the style sheet file is accessed.

Finally, you can return the results directly to a browser through the ASP Response object, and you can control the encoding used by setting the Output Encoding property.

In the next chapter, we'll discuss HTTP database publishing, an alternative approach to retrieving XML data from SQL Server 2000.



Programming Microsoft SQL Server 2000 With Xml
Programming Microsoft SQL Server(TM) 2000 with XML (Pro-Developer)
ISBN: 0735613699
EAN: 2147483647
Year: 2005
Pages: 89

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net