I am querieng a database that returns me a table with the results of the query in 3 columns. This query is run multiple times and the datatable has more results added to the previous ones each time the query is run and its results are added to the end of the existing datatable. My problem is that i have an additional 2 columns of information i want to add to to the 3 columns returned by the query each time it is run. This info comes from a string. So for example, i run the query and it returns this datatable:
Part No. Color Price
1234 Blue 12.50
5678 Red 13.25
Now i want to add two additional columns called Name and Damaged so the final result after the query is run will be:
Part No. Color Price Name Damaged
1234 Blue 12.50 Kite No
5678 Red 13.25 Knife Yes
The next time the query is run, all 5 columns should be in the datatable and the query should all info the the first three. Then i should be able to add the name and damaged info alongside the query result. How can i get this to work?
you can use temporary datatable with 5 columns, keep the latest rows retrieved in that and then according to user input update temporary table and then user dt.Merge() and merge this temporary table with original table that has rows previously added.