I have two DataTables which has the following rows.
Table A:
TaxID TaxName
------ --------
1 VAT
2 Sales Tax
Table B:
TaxID TaxName
----- --------
1A ED
2A Discount
In Table A: The datatype for the column TaxID is INT
In Table B: The datatype for the column TaxID is String.
Now I want to merge these two tables.
I tried like this:
TableA.Merge(TableB);
But it gives error.
how to achieve this?
You cannot change a DataColumn’s DataType after the Datatable was populated with data. So you should cast it with SQL to the appropriate type(
varchar) before you fill it.For example: