473,763 Members | 7,044 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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>S2 18575</sales_order>
</header>
- <detail>
<sod_part>77654 5995278</sod_part>
<batch_code />
<input_qty />
</detail>
- <detail>
<sod_part>77654 5981110</sod_part>
<batch_code />
<input_qty />
</detail>
- <footer>
<total_qty>7</total_qty>
<total_wt>221.7 4</total_wt>
</footer>
</subreport>
</report>
Nov 16 '05 #1
6 1690
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****@microso ft.com> wrote in message
news:%2******** ********@TK2MSF TNGP15.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>S2 18575</sales_order>
</header>
- <detail>
<sod_part>77654 5995278</sod_part>
<batch_code />
<input_qty />
</detail>
- <detail>
<sod_part>77654 5981110</sod_part>
<batch_code />
<input_qty />
</detail>
- <footer>
<total_qty>7</total_qty>
<total_wt>221.7 4</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******@onlin e.microsoft.com > wrote in message
news:eA******** ********@TK2MSF TNGP09.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****@microso ft.com> wrote in message
news:%2******** ********@TK2MSF TNGP15.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>S2 18575</sales_order>
</header>
- <detail>
<sod_part>77654 5995278</sod_part>
<batch_code />
<input_qty />
</detail>
- <detail>
<sod_part>77654 5981110</sod_part>
<batch_code />
<input_qty />
</detail>
- <footer>
<total_qty>7</total_qty>
<total_wt>221.7 4</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******@onlin e.microsoft.com > wrote in message
news:eA******** ********@TK2MSF TNGP09.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****@microso ft.com> wrote in message
news:%2******** ********@TK2MSF TNGP15.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>S2 18575</sales_order>
</header>
- <detail>
<sod_part>77654 5995278</sod_part>
<batch_code />
<input_qty />
</detail>
- <detail>
<sod_part>77654 5981110</sod_part>
<batch_code />
<input_qty />
</detail>
- <footer>
<total_qty>7</total_qty>
<total_wt>221.7 4</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****@microso ft.com> wrote in message
news:%2******** *******@TK2MSFT NGP14.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******@onlin e.microsoft.com > wrote in message
news:eA******** ********@TK2MSF TNGP09.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****@microso ft.com> wrote in message
news:%2******** ********@TK2MSF TNGP15.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>S2 18575</sales_order>
</header>
- <detail>
<sod_part>77654 5995278</sod_part>
<batch_code />
<input_qty />
</detail>
- <detail>
<sod_part>77654 5981110</sod_part>
<batch_code />
<input_qty />
</detail>
- <footer>
<total_qty>7</total_qty>
<total_wt>221.7 4</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****@microso ft.com> wrote in message
news:eE******** ******@TK2MSFTN GP12.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******@onlin e.microsoft.com > wrote in message
news:eA******** ********@TK2MSF TNGP09.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****@microso ft.com> wrote in message
news:%2******** ********@TK2MSF TNGP15.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>S2 18575</sales_order>
> </header>
> - <detail>
> <sod_part>77654 5995278</sod_part>
> <batch_code />
> <input_qty />
> </detail>
> - <detail>
> <sod_part>77654 5981110</sod_part>
> <batch_code />
> <input_qty />
> </detail>
> - <footer>
> <total_qty>7</total_qty>
> <total_wt>221.7 4</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******@onlin e.microsoft.com > wrote in message
news:%2******** *******@TK2MSFT NGP15.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****@microso ft.com> wrote in message
news:eE******** ******@TK2MSFTN GP12.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******@onlin e.microsoft.com > wrote in message
news:eA******** ********@TK2MSF TNGP09.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****@microso ft.com> wrote in message
news:%2******** ********@TK2MSF TNGP15.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>S2 18575</sales_order>
> </header>
> - <detail>
> <sod_part>77654 5995278</sod_part>
> <batch_code />
> <input_qty />
> </detail>
> - <detail>
> <sod_part>77654 5981110</sod_part>
> <batch_code />
> <input_qty />
> </detail>
> - <footer>
> <total_qty>7</total_qty>
> <total_wt>221.7 4</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
4608
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. I'm getting some strange results depending the input XML file I use. I was wondering if somebody could help me understand what is going on or point me to a good reference. The code for my program looks like this:
0
1117
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 "record definition" class. Then I use this DataSet to write and read data to and from an XML file My issue is that I as I make revisions to my application and change the type of data a certain (DataSet Column) node contains, It causes my DataSet to...
4
5209
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 advanced. rgds,
1
2186
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 table names that are in the XML file, but I'm not able to access the rows. Here's the code that I've got - it assumes that the fileName passed in already exists: Public Sub GetInput(ByVal fileName As String) dsFileCopy = New...
4
12808
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 to read text file but could not get the data in correct format. All columns are not coming in dataset and rows are messing up. Suggestions please ???
9
22503
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 namespaces and classes should I use and how? -- dba123
5
5086
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 have it store info it gets from when the programs check in into a DataSet (XML file). Problem is, that file now has to be used by other programs to find out version information (the file is ALWAYS less that 1K.) The record itself is only five fields...
3
8028
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 message. TIA Brad Here's a snippet of my source code:
8
3756
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 XmlDataSource object (CurrentXMLData): Stream newStream = myWebClient.OpenRead(myStringWebResource); TextReader newReader = new StreamReader(newStream); string newData = newReader.ReadToEnd(); CurrentXMLData.Data = newData;
1
4702
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\""; Column Name 'Sol 1' and 'Sol 2' is missing even though it is reading the readings. Just not able to read column names. I am not sure about what is exact problem. so please help me in solving this. Thanx in advance.
0
9563
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9386
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9822
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8821
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7366
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6642
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5270
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3917
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3522
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.