Configuring SQL XML Support in IIS

Source: Internet
Author: User

First, let's say the purpose of our example is to have the database output XML and use it down in the. NET System.

The data tier of this system is a SQL Server database, and the middle tier is implemented with the SQL self-contained tool "Configure SQL XML support in IIS". OK, now that we're done, let's first configure the SQL output XML:

This thing sounds a bit mysterious, in fact, after our normal query statement to add: for XML AUTO.
Give an example:

SELECT Top Topic,name,time
From the BBS where [order]=1 order by [TIME] DESC
For XML AUTO

The result of this statement in the SQL Query Analyzer is that the output is not a table of our traditional concepts, it's a few rows of strings, and the content is the XML code we need.

This first step allows the SQL output XML to complete.

Then start our 2nd step so that the XML file can be invoked on the Web

After this statement has been successfully debugged, you can create a file: for example, Aaa.xml
The contents are as follows:

<root xmlns:sql= "Urn:schemas-microsoft-com:xml-sql" >
<sql:query>
SELECT Top Topic,name,time
From the BBS where [order]=1 order by [TIME] DESC
For XML AUTO
</sql:query>
</ROOT>

Set up a BBB catalogue in C:\ and put him in.

The middle part is our traditional SQL statement, which is one of our common formats.

Put this file in a random directory, and then open SQL to configure SQL XML support in IIS
Holding "In need of XML support site to create a virtual directory, the name is called CCC Bar, the local path is naturally our c:\bbb."
Then click Security--Type your SQL username and password, then the data source, which is your database location with the default database.
Then click Set, select Allow Template query, then point virtual name, dot new type is template name called
DDD, the corresponding file is our aaa.xml.

Then open in IE inside: http://your machine name/ccc/ddd
What did you see? Yes, that's the output of your XML file in the SQL query.
What doesn't output? Open your Internet Information Services (IIS) Manager and choose web Extension Clothing
Service ",
Then the "All unknown ISAP extensions" option is allowed. Is it OK now?

OK, and then there's our most critical step in the 3rd step-how to call this dynamically generated XML file in Vs.net.

First we want to create an empty unstructured dataset1, and then in the source code inside the This.dataSet1.Locale = new System.Globalization.CultureInfo ("ZH-CN");
Then add a this.dataSet1.ReadXml ("http://Your machine name/ccc/ddd");

Congratulations, you can now use the dynamically generated XML file as a read-only dataset.

This article from the Internet, welcomed the original author and edit contact, signed copyright Zujizhe@Chinaz.com



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.