I am finding it difficult to loop through a table using C# and output the file in XML to my anticipated format. Here is what I am trying to achieve. Let us assume my data (table) is below.
col1, col2
A , 1
A , 2
A , 3
B , 1
B , 2
C , 1
My xml output file should be something like
A, 1, 2, 3
B, 1, 2
C, 1
In other words if col1 repeats itself in the table then append col2. The example above seems straightforward but it is not the exact situation. The exact situation is in the attachments below.
I have attached the original access database (db.accdb) that contains the tables, C# code (C#-code), xml output file after running the C# code (XML_data.xml), and anticipated output file (XML_data-Want.xml).
The anticipated output file (XML_data-Want.xml) is the exact data I am trying to output using C#.
Any help is greatly appreciated. Please do not just suggest answers. Provide the solution by giving me the exact C# code.
Thanks again.