Return XML from SQL Server

T

Tor Inge Rislaa

By using Virtual Directory I can return XML Data to my browser by either
using Transact SQL directly in my URL as below:


http://localhost/MyVirualDirector?sql=SELECT+ CustomerID+ CompanyName +FROM+
Customers +FOR+XML+AUTO,+ELEMENTS&root= MyList

Or by include my query within an XML and call it trough my Virual Director
as:

http://localhost/TIR/ MyList.xml

MyList.xml typed out:

<?xml version="1.0" encoding="UTF-8"?>
<MyList xmlns:sql='urn:schemas-microsoft-com:xml-sql'>
<sql:query>
SELECT CustomerID, CompanyName
Customers
XML AUTO, ELEMENTS
</sql:query>
</MyList>

I am wondering if it is possible to get a call (e.g.
http://localhost/MyList.aspx) to an ASP.NET page to return XML to my browser
as above. And if it is possible can I as well pass some parameters to be
variables in the Transact SQL within the .aspx

The method I am using to day needs some action from my Internet Service
Provider like applying the virtual directory and mapping to my template XML
file. I would like to include my connection settings within my .aspx so that
I have full control over the application.

Anyone having a little example on how to do this

TIRislaa
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,774
Messages
2,569,598
Members
45,147
Latest member
CarenSchni
Top