473,327 Members | 2,112 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,327 software developers and data experts.

new to XMLReader

Hi,
I'm doing an XML project, and I've gotten to the point where I retreive my
data from my SQL Server, and execute my XML Reader. How can I display the
XML in a browser window now? Here is my code:

string tXML;

SqlCommand objCmd = new SqlCommand ("up_get_XMLStandardExterior",
dbConnect());

objCmd.CommandType=CommandType.StoredProcedure;

SqlParameter objParam = new SqlParameter ("@nControlIDNumber",
DbType.Int16);

objParam.Direction=ParameterDirection.Input;

objParam.Value=1;

objCmd.Parameters.Add(objParam);

System.Xml.XmlReader myXmlReader = objCmd.ExecuteXmlReader();

myXmlReader.Close

Early thanks for any help.

John D. Morris
Nov 12 '05 #1
2 3589
Are you running this from a server or client application?

"John D. Morris" <jm*****@sni.org> wrote in message
news:i0******************@dfw-read.news.verio.net...
Hi,
I'm doing an XML project, and I've gotten to the point where I retreive my data from my SQL Server, and execute my XML Reader. How can I display the
XML in a browser window now? Here is my code:

string tXML;

SqlCommand objCmd = new SqlCommand ("up_get_XMLStandardExterior",
dbConnect());

objCmd.CommandType=CommandType.StoredProcedure;

SqlParameter objParam = new SqlParameter ("@nControlIDNumber",
DbType.Int16);

objParam.Direction=ParameterDirection.Input;

objParam.Value=1;

objCmd.Parameters.Add(objParam);

System.Xml.XmlReader myXmlReader = objCmd.ExecuteXmlReader();

myXmlReader.Close

Early thanks for any help.

John D. Morris

Nov 12 '05 #2
I am running it from an aspx page. After a little trial and error I managed
to get the XML displayed in a browser, and exported to a file. Here is my
code snippet if anyone is interested:

System.Xml.XmlReader myXmlReader = objCmd.ExecuteXmlReader();

myXmlReader.Read();

//output it to a file...

StreamWriter sr = File.CreateText("C:\\test2.xml");

sr.WriteLine (myXmlReader.ReadOuterXml());

myXmlReader.Close();

sr.Close();

"Peter Rilling" <pe***@nospam.rilling.net> wrote in message
news:uw**************@TK2MSFTNGP12.phx.gbl...
Are you running this from a server or client application?

"John D. Morris" <jm*****@sni.org> wrote in message
news:i0******************@dfw-read.news.verio.net...
Hi,
I'm doing an XML project, and I've gotten to the point where I retreive
my
data from my SQL Server, and execute my XML Reader. How can I display

the XML in a browser window now? Here is my code:

string tXML;

SqlCommand objCmd = new SqlCommand ("up_get_XMLStandardExterior",
dbConnect());

objCmd.CommandType=CommandType.StoredProcedure;

SqlParameter objParam = new SqlParameter ("@nControlIDNumber",
DbType.Int16);

objParam.Direction=ParameterDirection.Input;

objParam.Value=1;

objCmd.Parameters.Add(objParam);

System.Xml.XmlReader myXmlReader = objCmd.ExecuteXmlReader();

myXmlReader.Close

Early thanks for any help.

John D. Morris


Nov 12 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Shivonne | last post by:
Hi all Having problems with the XmlReader object. I'm trying to transform an XML document with XSLT - and get the resulting output. My code is as follows: XsltArgumentList xslArgs =...
5
by: xmlguy | last post by:
I believe this should be pretty elementary, but for some reason I cannot seem to think of how to write the an XML file from an incoming XML file. Basically this is what I do: Input: ...
2
by: xmlguy | last post by:
Cant seem to solve this problem I need to be able to re-use XmlReader and XPathDocument for an XSLT Transform. Basically I have defined following interfaces: Class Render (Common and...
0
by: Matthew Heironimus | last post by:
According to the XML 1.0 (Third Edition) W3C Recommendation (http://www.w3.org/TR/2004/REC-xml-20040204/#sec-line-ends) all #xD, #xA, and #xD#xA character combinations should be converted to a...
1
by: Matthew Heironimus | last post by:
According to the XML 1.0 (Third Edition) W3C Recommendation (http://www.w3.org/TR/2004/REC-xml-20040204/#sec-line-ends) all #xD, #xA, and #xD#xA character combinations should be converted to a single...
1
by: Angus Lepper | last post by:
I'm writing a stock ticker for a stock market simulation, and can load the data into the xmlreader in the first place, but can't figure out how to refresh/update the data in it. Any ideas? Code:...
0
by: Jen | last post by:
My main question: "How can I get a TextReader or Stream object from an existing XmlReader?". Read on for more: I have an existing XmlReader. Let's call it reader1. I'm creating another reader,...
6
by: Rob Meade | last post by:
Hi all, I'm having a few difficulties with the above, ie I cant find any good examples anywhere of how to do what I want to do! I have an xml file on my desktop which I want to read in. ...
2
by: jonfroehlich | last post by:
According to the MSDN documentation within the XmlTextReader class for ..NET 2.0, the recommended practice to create XmlReader instances is using the XmlReaderSettings class and the...
5
by: heday60 | last post by:
I've got this application that watches a directory for XML's and then parses them into a DB. It then moves them based on if the XML was succesful or a bad XML... foreach(FileInfo file in...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.