Hi there...
I'm still learning about data tables so I hope somebody can assist....and assume I know nothing :)
I have a dataset with a datatable defined. I'll just say Dataset1 and datatable1 with all the columns made in the dataset.
I create a new instance of datatable1 called "dtsale" and fill it with data using an SQL query.
I create a new instance of datatable1 called "dtcanc" and fill it with data using an SQL query.
I then do some calculations in .NET on a column in the datatable in a column called STATUS
eg.
dtsale.Columns("STATUS").Expression = "'SALE'"
dtcanc.Columns("STATUS").Expression = "'CANC'"
.. I have these two tables, with same columns.. I want to do a merge / union so one set of data is placed below the other. I then put the datatable into Excel.
I can get it into Excel no problem using dtsale or dtcanc but not the two together.
below is code I have tried but it's not right.
Any help is appreciated. Doing the UNION in SQL before I put into a datatable isn't an option for me on this occasion due to some other calculations I'm doing before the merge.
Kind Regards
I'm still learning about data tables so I hope somebody can assist....and assume I know nothing :)
I have a dataset with a datatable defined. I'll just say Dataset1 and datatable1 with all the columns made in the dataset.
I create a new instance of datatable1 called "dtsale" and fill it with data using an SQL query.
I create a new instance of datatable1 called "dtcanc" and fill it with data using an SQL query.
I then do some calculations in .NET on a column in the datatable in a column called STATUS
eg.
dtsale.Columns("STATUS").Expression = "'SALE'"
dtcanc.Columns("STATUS").Expression = "'CANC'"
.. I have these two tables, with same columns.. I want to do a merge / union so one set of data is placed below the other. I then put the datatable into Excel.
I can get it into Excel no problem using dtsale or dtcanc but not the two together.
below is code I have tried but it's not right.
Code:
dtcanc.Merge(dtsale)
Kind Regards