473,394 Members | 1,828 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,394 software developers and data experts.

Problems with getting XML into dataset???

I am using the following code to take a simple XML string and put it into a
dataset:

DataSet ds = new DataSet();
ds.ReadXml(new StringReader(document));

It puts the XML into a dataset alright but in transforms each and every node
into a separate table when it needs to be a row. in other words the parent
node "account needs to be the table and the nodes under it need to be the
rows. s it my XML or do I need to change my code or parameters or what??

The XML takes the basic form of:

<account><accountcategorycode name="name_1">1</accountcategorycode>
<accountclassificationcode name="name_1">1</accountclassificationcode>
<accountnumber>accountnumber_1</accountnumber>
<accountratingcode name="name_1">1</accountratingcode>
<address1_addresstypecode name="name_1">1</address1_addresstypecode>
<address1_city>address1_city_1</address1_city>
<address1_country>address1_country_1</address1_country>
<address1_county>address1_county_1</address1_county>
<address1_fax>address1_fax_1</address1_fax>
<address1_freighttermscode name="name_1">1</address1_freighttermscode>

<address1_latitude>1.0</address1_latitude><address1_line1>address1_line1_1 </
address1_line1>
<address1_line2>address1_line2_1</address1_line2>
<address1_line3>address1_line3_1</address1_line3>
<address1_longitude>1.0</address1_longitude>
<address1_name>address1_name_1</address1_name>
<address1_postalcode>address1_postalcode_</address1_postalcode>
</account>
Nov 16 '05 #1
5 1097
Hi Acool,

After a long time searching, I finally was so very easy.

I hope this helps?

Cor

Serialize
using System.IO;
\\\\
StringWriter sw = new StringWriter;
ds.WriteXml(sw);
string mystring = sw.toString;
///
Deserialize
\\\
StringReader sr = StringReader(mystring);
DataSet ds2 = new DataSet;
ds2.ReadXml(sr);
///
Nov 16 '05 #2
Yeah, that doesn't do anything not to mention the code is FILLED with
syntactical errors.
"Cor Ligthert" <no**********@planet.nl> wrote in message
news:eJ**************@TK2MSFTNGP12.phx.gbl...
Hi Acool,

After a long time searching, I finally was so very easy.

I hope this helps?

Cor

Serialize
using System.IO;
\\\\
StringWriter sw = new StringWriter;
ds.WriteXml(sw);
string mystring = sw.toString;
///
Deserialize
\\\
StringReader sr = StringReader(mystring);
DataSet ds2 = new DataSet;
ds2.ReadXml(sr);
///

Nov 16 '05 #3
>Yeah, that doesn't do anything not to mention the code is FILLED with
syntactical errors.


Hi Accool are you not able to edit those simple () and that "new" what is
forgotten on one place.
It is not that we made your code here.

I changed it fast from VB to C# in this message

Are you sure you understand it?

In VB it works as a train and now I did it in the IDE I think also in C#.

Cor

Nov 16 '05 #4
I understand that it didn't work and I found an alternate solution.
"Cor Ligthert" <no**********@planet.nl> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
Yeah, that doesn't do anything not to mention the code is FILLED with
syntactical errors.


Hi Accool are you not able to edit those simple () and that "new" what is
forgotten on one place.
It is not that we made your code here.

I changed it fast from VB to C# in this message

Are you sure you understand it?

In VB it works as a train and now I did it in the IDE I think also in C#.

Cor

Nov 16 '05 #5
Hi acool,
I understand that it didn't work and I found an alternate solution.


When you do not understand code, it is good to try it, the least that can
happen is that you learn from it.

Cor
Nov 16 '05 #6

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

Similar topics

10
by: acool | last post by:
I am using the following code to take a simple XML string and put it into a dataset: DataSet ds = new DataSet(); ds.ReadXml(new StringReader(document)); It puts the XML into a dataset alright...
7
by: Martin Hazell | last post by:
I have had a form within a project that has been tested and working for the past 4-5 months. The other day, I decided to change all of my database connection strings into a dynamic property for a...
3
by: Lloyd Sheen | last post by:
I am having trouble with an app that does the following: 1. Query SQL Server and return one row 2. Bind the columns to text boxes 3. User updates info 4. User clicks update button ...
1
by: news.microsoft.com | last post by:
I have used typed datasets by creating a Data Component (data.vb) by creating a new component in a vb or asp/vb.net project, dragging data tables onto the component, which generates the connection...
1
by: Gavin Pollock | last post by:
Is anyone using Caching (HttpRuntime.Cache) in Whidbey? Not sure if there's another newsgroup for this though since it's still beta.... I'm having issues running a system built on 1.1 in a 2.0...
0
by: optimizeit | last post by:
What I am attempting to do is import an Excel Workbook and display the worksheets in a datagrid dynamically. I am very close to getting this to work. I have to this point successfully imported a...
3
by: Mike Fellows | last post by:
were currently having a rollout of windows xp pro on all our machines everything has seemed to be fine except that in our vb.net application none of the comboboxes are getting there lists...
1
by: Mundo | last post by:
Hi I'm pulling my hair out with a problem caused when DataBinding a DataSet to a web control. I first tried using a GridView but when that failed, I tried a Repeater. I'm getting the classic...
0
by: SAL | last post by:
I'm curious if anyone else is having this problem. If I let the Dataset designer generate update commands for me, I don't seem to be able to get them to work without an exception getting thrown,...
1
by: Dave | last post by:
I'm having problems getting the GridView to reliably display a large amount of data (50,000+ rows). I am working my way through the excellent book “Real World ASP.NET Best Practices” by Farhan...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.