473,326 Members | 2,108 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,326 software developers and data experts.

Error: This document already has a 'DocumentElement' node

Hi,

I tried the below code to convert the sql table to xmlDocument. But it
is giving error in doc.Load(reader) Could anyone please help me out.
conn.Open();

string sql = "select ProductId, ProductName from Products FOR
XML AUTO";

SqlCommand comm = new SqlCommand(sql, conn);

XmlReader reader = comm.ExecuteXmlReader();

XmlDocument doc = new XmlDocument() ;

doc.Load(reader);

reader.Close();
conn.Close();

return doc;

Jun 16 '06 #1
0 2998

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

Similar topics

1
by: Supra | last post by:
i got "system error" when saving to xml file. i am using checkbox1 control to xml. when user clicked checkbox and set to true and press btnOk to conform and save it to xml ...
4
by: Cathie | last post by:
Hi All, I am trying to get my style sheet to work. It works fine in IE but I can't get it to work in .net. Below is the function I use for transforming, where advancedOptionsFile is the path...
0
by: Supra | last post by:
i got "system error" when saving to xml file. i am using checkbox1 control to xml. when user clicked checkbox and set to true and press btnOk to conform and save it to xml ...
3
by: GhislainTanguay | last post by:
This is my XML file and below you will find my code to remove it... I was thinking that it's a simple task but this code doesn't work. Anybody have a better solution? <Advertisements>
2
by: Shaurya Vardhan | last post by:
Hi, On Appending a child in XML Node, I am having error, "Run-time exception thrown : System.ArgumentException - The node to be inserted is from a different document context." How to resolve...
3
by: Eroc | last post by:
I'm new to XML files so I'm kinda lost here. I found some example code on reading an XML file. My objective is simple. Read the whole XML file into memory. Here is part of my code: Private...
1
by: Viral | last post by:
Hello All, I have the following XML document : (for ease of understanding i am just posting a part of it) Base XML ------------ <?xml version="1.0"?> <ROOT>...
3
by: suganya | last post by:
Hi Some professionals already has developed the project using menu. In my company, they have given me task to clear the error in that. It is a script file named as "menubarAPI4.js" which is kept...
8
by: dhtml | last post by:
Other than Safari 2, what other browsers that support document.clientHeight ? I would guess some KHTML did. I have found the feature, when it is present, to reliably provide the height of the...
3
by: Wuggles | last post by:
Hi guys, I want to use a Curser position function with javascript like this: <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled...
1
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: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
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.