Solved

sqlserver query to output xml into asp.net page

Posted on 2013-01-25
2
321 Views
Last Modified: 2013-01-25
Hi!

i Have simple data connection like this

Dim GetDataQry As String = "SELECT * from facilities where ItemID=@ItemId FOR XML PATH"
            Dim cmd As New SqlClient.SqlCommand(GetDataQry, conn)

with a SqlDataReader.

but it outputs only text. not xml as the query requests.
how do i get it to output xml into a asp.net page.
0
Comment
Question by:jamppi
2 Comments
 
LVL 35

Accepted Solution

by:
Robert Schutt earned 305 total points
ID: 38820613
If you're writing this out to the page it could be that the browser is hiding the xml tags as unknown html tags, in that case you could try something like:
Response.Write yourxmlstringvar.Replace("<", "&lt;")

Open in new window

0
 

Author Closing Comment

by:jamppi
ID: 38820809
you got me on right track..  i had to change the document properties to
Response.ContentType = "text/xml"

then i got it right!

/J
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
Via a live example combined with referencing Books Online, show some of the information that can be extracted from the Catalog Views in SQL Server.
Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now