I need help with a logic to enter some data into datatable.I have a list(of string) that would be dynamic. I need to enter all the list values to to datarow in a datable. So first image would consist of already existing data
as input . And I want the string contents in my list to be added with seperate header along with the data in result . Second image would be result. Header Value 1 should be the first list value and so on. Also this list would be dynamic so I need to add data and Header for the list values i get. Can i get a help on this? Thanks!!!
Create the DataTable with fixed columns first, then loop through the List(Of String) and dynamically add columns using add data column. After adding the columns, create a new DataRow, assign existing data to fixed columns, and assign each list value to its corresponding dynamic column using index-based mapping, then add the DataRow to the DataTable.
Hey @SorenB Header. This Header data I am assigning a fixed value with counter variable. But I need the list(string) values to be added in datarow. Thanks for this solution. I will try this and let you know.