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

Reading an xml file into Dataset

Hi All;

I'm reading the following xml file into a Dataset but there are only 4
datatables in my dataset (which should be 5)
Is that because I have two nodes with the same name (detail) in my xml file?
how can I fix this?

Thanks for your time.

<?xml version="1.0" ?>
- <report>
- <subreport>
- <header>
<sales_order>S218575</sales_order>
</header>
- <detail>
<sod_part>776545995278</sod_part>
<batch_code />
<input_qty />
</detail>
- <detail>
<sod_part>776545981110</sod_part>
<batch_code />
<input_qty />
</detail>
- <footer>
<total_qty>7</total_qty>
<total_wt>221.74</total_wt>
</footer>
</subreport>
</report>
Nov 16 '05 #1
6 1669
The two <detail> nodes are being interpreted as different rows in one and
the same table, and this table has three columns: sod_part, batch_code, and
input_qty.

I'm not quire sure what you are expecting. It seems to make sense to use
just one detail table with sod_part as key. What are you trying to
accomplish?
--
Kai Brinkmann [MSFT]

Please do not send e-mail directly to this alias. This alias is for
newsgroup purposes only.
This posting is provided "AS IS" with no warranties, and confers no rights.
"ALI-R" <ne****@microsoft.com> wrote in message
news:%2****************@TK2MSFTNGP15.phx.gbl...
Hi All;

I'm reading the following xml file into a Dataset but there are only 4
datatables in my dataset (which should be 5)
Is that because I have two nodes with the same name (detail) in my xml
file?
how can I fix this?

Thanks for your time.

<?xml version="1.0" ?>
- <report>
- <subreport>
- <header>
<sales_order>S218575</sales_order>
</header>
- <detail>
<sod_part>776545995278</sod_part>
<batch_code />
<input_qty />
</detail>
- <detail>
<sod_part>776545981110</sod_part>
<batch_code />
<input_qty />
</detail>
- <footer>
<total_qty>7</total_qty>
<total_wt>221.74</total_wt>
</footer>
</subreport>
</report>

Nov 16 '05 #2
so ,,how come when I get this command "ds.Tables["detail"].Rows.Count" ,it
shows only "1" (it means that there is only one row in that table ,whereas
ther should be two,right?)

Thanks for yuor help.

"Kai Brinkmann [MSFT]" <ka******@online.microsoft.com> wrote in message
news:eA****************@TK2MSFTNGP09.phx.gbl...
The two <detail> nodes are being interpreted as different rows in one and
the same table, and this table has three columns: sod_part, batch_code, and input_qty.

I'm not quire sure what you are expecting. It seems to make sense to use
just one detail table with sod_part as key. What are you trying to
accomplish?
--
Kai Brinkmann [MSFT]

Please do not send e-mail directly to this alias. This alias is for
newsgroup purposes only.
This posting is provided "AS IS" with no warranties, and confers no rights.

"ALI-R" <ne****@microsoft.com> wrote in message
news:%2****************@TK2MSFTNGP15.phx.gbl...
Hi All;

I'm reading the following xml file into a Dataset but there are only 4
datatables in my dataset (which should be 5)
Is that because I have two nodes with the same name (detail) in my xml
file?
how can I fix this?

Thanks for your time.

<?xml version="1.0" ?>
- <report>
- <subreport>
- <header>
<sales_order>S218575</sales_order>
</header>
- <detail>
<sod_part>776545995278</sod_part>
<batch_code />
<input_qty />
</detail>
- <detail>
<sod_part>776545981110</sod_part>
<batch_code />
<input_qty />
</detail>
- <footer>
<total_qty>7</total_qty>
<total_wt>221.74</total_wt>
</footer>
</subreport>
</report>


Nov 16 '05 #3
I'd like to simly extract "details" nodes and show them in a datagrid and
let the user edit some childs of it.
That's it.
Thanks
"Kai Brinkmann [MSFT]" <ka******@online.microsoft.com> wrote in message
news:eA****************@TK2MSFTNGP09.phx.gbl...
The two <detail> nodes are being interpreted as different rows in one and
the same table, and this table has three columns: sod_part, batch_code, and input_qty.

I'm not quire sure what you are expecting. It seems to make sense to use
just one detail table with sod_part as key. What are you trying to
accomplish?
--
Kai Brinkmann [MSFT]

Please do not send e-mail directly to this alias. This alias is for
newsgroup purposes only.
This posting is provided "AS IS" with no warranties, and confers no rights.

"ALI-R" <ne****@microsoft.com> wrote in message
news:%2****************@TK2MSFTNGP15.phx.gbl...
Hi All;

I'm reading the following xml file into a Dataset but there are only 4
datatables in my dataset (which should be 5)
Is that because I have two nodes with the same name (detail) in my xml
file?
how can I fix this?

Thanks for your time.

<?xml version="1.0" ?>
- <report>
- <subreport>
- <header>
<sales_order>S218575</sales_order>
</header>
- <detail>
<sod_part>776545995278</sod_part>
<batch_code />
<input_qty />
</detail>
- <detail>
<sod_part>776545981110</sod_part>
<batch_code />
<input_qty />
</detail>
- <footer>
<total_qty>7</total_qty>
<total_wt>221.74</total_wt>
</footer>
</subreport>
</report>


Nov 16 '05 #4
Sorry ,I made a mistake for this posting ds.Tables["detail"].Rows.Count
exactly returns the number of "detail" nodes in the xml file.Say if there is
6 "detail" nodes in xml it returns 6 and if there is only 1 "detail" nodes
,it returns 1.

"ALI-R" <ne****@microsoft.com> wrote in message
news:%2***************@TK2MSFTNGP14.phx.gbl...
so ,,how come when I get this command "ds.Tables["detail"].Rows.Count" ,it shows only "1" (it means that there is only one row in that table ,whereas
ther should be two,right?)

Thanks for yuor help.

"Kai Brinkmann [MSFT]" <ka******@online.microsoft.com> wrote in message
news:eA****************@TK2MSFTNGP09.phx.gbl...
The two <detail> nodes are being interpreted as different rows in one and the same table, and this table has three columns: sod_part, batch_code,

and
input_qty.

I'm not quire sure what you are expecting. It seems to make sense to use
just one detail table with sod_part as key. What are you trying to
accomplish?
--
Kai Brinkmann [MSFT]

Please do not send e-mail directly to this alias. This alias is for
newsgroup purposes only.
This posting is provided "AS IS" with no warranties, and confers no

rights.


"ALI-R" <ne****@microsoft.com> wrote in message
news:%2****************@TK2MSFTNGP15.phx.gbl...
Hi All;

I'm reading the following xml file into a Dataset but there are only 4
datatables in my dataset (which should be 5)
Is that because I have two nodes with the same name (detail) in my xml
file?
how can I fix this?

Thanks for your time.

<?xml version="1.0" ?>
- <report>
- <subreport>
- <header>
<sales_order>S218575</sales_order>
</header>
- <detail>
<sod_part>776545995278</sod_part>
<batch_code />
<input_qty />
</detail>
- <detail>
<sod_part>776545981110</sod_part>
<batch_code />
<input_qty />
</detail>
- <footer>
<total_qty>7</total_qty>
<total_wt>221.74</total_wt>
</footer>
</subreport>
</report>



Nov 16 '05 #5
You should data bind the grid to the Detail table then. Each detail node
will appear as one row in the grid. You can edit the data in the three
columns and save the changes back to the underlying dataset (which the table
belongs to). After that, just write the dataset back to XML to update the
file.
--
Kai Brinkmann [MSFT]

Please do not send e-mail directly to this alias. This alias is for
newsgroup purposes only.
This posting is provided "AS IS" with no warranties, and confers no rights.

"ALI-R" <ne****@microsoft.com> wrote in message
news:eE**************@TK2MSFTNGP12.phx.gbl...
I'd like to simly extract "details" nodes and show them in a datagrid and
let the user edit some childs of it.
That's it.
Thanks
"Kai Brinkmann [MSFT]" <ka******@online.microsoft.com> wrote in message
news:eA****************@TK2MSFTNGP09.phx.gbl...
The two <detail> nodes are being interpreted as different rows in one and
the same table, and this table has three columns: sod_part, batch_code,

and
input_qty.

I'm not quire sure what you are expecting. It seems to make sense to use
just one detail table with sod_part as key. What are you trying to
accomplish?
--
Kai Brinkmann [MSFT]

Please do not send e-mail directly to this alias. This alias is for
newsgroup purposes only.
This posting is provided "AS IS" with no warranties, and confers no

rights.


"ALI-R" <ne****@microsoft.com> wrote in message
news:%2****************@TK2MSFTNGP15.phx.gbl...
> Hi All;
>
> I'm reading the following xml file into a Dataset but there are only 4
> datatables in my dataset (which should be 5)
> Is that because I have two nodes with the same name (detail) in my xml
> file?
> how can I fix this?
>
> Thanks for your time.
>
> <?xml version="1.0" ?>
> - <report>
> - <subreport>
> - <header>
> <sales_order>S218575</sales_order>
> </header>
> - <detail>
> <sod_part>776545995278</sod_part>
> <batch_code />
> <input_qty />
> </detail>
> - <detail>
> <sod_part>776545981110</sod_part>
> <batch_code />
> <input_qty />
> </detail>
> - <footer>
> <total_qty>7</total_qty>
> <total_wt>221.74</total_wt>
> </footer>
> </subreport>
> </report>
>
>



Nov 16 '05 #6

My datagrid is now bound and working,thanks for your help.
Now I have two other issues:

1)My datagrid is in another form and I need to return the value of a coulmn
which user has selected to the caller form (in a textbox),I know how the get
the value of an specific coulmn in the selected row ,but I don't know how to
return it to the called

2) I don't need all those columns from datagrid ,I need only 2 of it,Dose
Dataview help for this senario?

Thanks again
"Kai Brinkmann [MSFT]" <ka******@online.microsoft.com> wrote in message
news:%2***************@TK2MSFTNGP15.phx.gbl...
You should data bind the grid to the Detail table then. Each detail node
will appear as one row in the grid. You can edit the data in the three
columns and save the changes back to the underlying dataset (which the table belongs to). After that, just write the dataset back to XML to update the
file.
--
Kai Brinkmann [MSFT]

Please do not send e-mail directly to this alias. This alias is for
newsgroup purposes only.
This posting is provided "AS IS" with no warranties, and confers no rights.
"ALI-R" <ne****@microsoft.com> wrote in message
news:eE**************@TK2MSFTNGP12.phx.gbl...
I'd like to simly extract "details" nodes and show them in a datagrid and let the user edit some childs of it.
That's it.
Thanks
"Kai Brinkmann [MSFT]" <ka******@online.microsoft.com> wrote in message
news:eA****************@TK2MSFTNGP09.phx.gbl...
The two <detail> nodes are being interpreted as different rows in one and the same table, and this table has three columns: sod_part, batch_code,

and
input_qty.

I'm not quire sure what you are expecting. It seems to make sense to use just one detail table with sod_part as key. What are you trying to
accomplish?
--
Kai Brinkmann [MSFT]

Please do not send e-mail directly to this alias. This alias is for
newsgroup purposes only.
This posting is provided "AS IS" with no warranties, and confers no

rights.


"ALI-R" <ne****@microsoft.com> wrote in message
news:%2****************@TK2MSFTNGP15.phx.gbl...
> Hi All;
>
> I'm reading the following xml file into a Dataset but there are only 4 > datatables in my dataset (which should be 5)
> Is that because I have two nodes with the same name (detail) in my xml > file?
> how can I fix this?
>
> Thanks for your time.
>
> <?xml version="1.0" ?>
> - <report>
> - <subreport>
> - <header>
> <sales_order>S218575</sales_order>
> </header>
> - <detail>
> <sod_part>776545995278</sod_part>
> <batch_code />
> <input_qty />
> </detail>
> - <detail>
> <sod_part>776545981110</sod_part>
> <batch_code />
> <input_qty />
> </detail>
> - <footer>
> <total_qty>7</total_qty>
> <total_wt>221.74</total_wt>
> </footer>
> </subreport>
> </report>
>
>



Nov 16 '05 #7

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

Similar topics

3
by: Bill C. | last post by:
Hi, I've got a simple console app that just reads an XML file into a DataSet then prints out a description of each table in the DataSet, including column names and row values for each column. ...
0
by: Earl Teigrob | last post by:
I would like to be able to validate an XML file before it is (or as it is being) read into a DataSet. I have a class that dynamically creates a DataSet with typed columns based on another...
4
by: Phoebe. | last post by:
Hi, Good Day! Reading 1 excel file into a dataset is fine. How can I read multiple excel with the same data structure into 1 dataset? How can I append those data? Can someone help? Thanks in...
1
by: hzgt9b | last post by:
(FYI, using VB .NET 2003) Can someone help me with this... I'm trying to read in an XML file... it appears to work in that the DataSet ReadXML method dose not fail and then I am able to access the...
4
by: Amit Maheshwari | last post by:
I need to read text file having data either comma seperated or tab seperated or any custom seperator and convert into a DataSet in C# . I tried Microsoft Text Driver and Microsoft.Jet.OLEDB.4.0...
9
by: dba123 | last post by:
I need some help and direction on what classes and an example or two (article) on how to read an Excel Worksheet and insert one column into a database table column. I am using .NET 2.0 only. What...
5
by: UJ | last post by:
I have a system that has five programs that all communicate with each other via Message Queues. Works well. One program is a watchdog that will make sure the others are up and going. Currently I...
3
by: Brad | last post by:
I'm having a problem reading data from an Excel file into a dataset. Can anybody give me an idea of what's happening? I've included the problematic source and the error message to the end of this...
8
by: T Driver | last post by:
Anyone have any idea how I can do the following? I have a connection to an XML file on a site I do not control, getting a string representation of the xml data that I can then feed to my...
1
by: sachinkale123 | last post by:
Hi, I am reading excel file and reading values from that I am using provider As : "Provider=Microsoft.Jet.OLEDB.4.0;Data Source = " + Filename + ";Extended Properties=\"Excel 8.0;Hdr=No;IMEX=1\"";...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.