Hi all, just wondering if what i've been doing for the last few months is the best method to get data from xml and onto datatables within a dataset or if there is a simpler way i have completely overlooked. Rather than go into the code i will explain the process step by step.
1/ setup a dataset and add tables with columns ready for data
2/ setup various classes so i can construct a list (or array) of a specific type
3/ get the xml into an XElement type.
4/ use LINQ to obtain a query from the xml
5/ use this query to create lines of the type we setup in step 2/
6/ use these lines to create a datarow and add to the relevent table.
7/ bind the table to a dgv to show the table.
Now i am wondering if i can say for the type in step 2/ use DataRow as the type thus missing out step 5/ ? is this possible? what other ways are there to get xml into a DataSet? One other method that occurs to me is to load the xml directly into the datatable (this is possible?) but i am not sure what the xml needs to look like for that to work. My xml is simple it contains only values and no parameters if that helps...
I require my final dgv to be sortable by column clicks etc so needs to comply to various interfaces, any pointers on this (perhaps i can avoid using a dataset and populate direct from my DataObjects so i only need steps 2, 3, 4, 5 and 7?)




Reply With Quote
