Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

sqlserver query to output xml into asp.net page

Posted on 2013-01-25
2
Medium Priority
?
334 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 35

Accepted Solution

by:
Robert Schutt earned 915 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

Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

Question has a verified solution.

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

Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.
Via a live example, show how to setup several different housekeeping processes for a SQL Server.

722 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