Omkar
Omkar

Reputation: 2149

Merging DataTable(s) Column by Column

I want to merge two or more DataTables Colum by Column. I am developing C# Windows Application. My use case is below:

  1. I have empty data grid in my application.
  2. user will drag and drop one column from available column list box into data grid. The data grid will start displaying data for that column.
  3. Now, I will drag another column into data grid and now grid should get populated data of two columns.
  4. This will repeat till user feels that he has dropped all necessary columns.

What is best way to do this? Is there any performance hits with large number of rows typically 1 million?

Please help.

Thanks, Omky

Upvotes: 0

Views: 1138

Answers (1)

Arsen Mkrtchyan
Arsen Mkrtchyan

Reputation: 50752

use DataTable.Merge if you really want to marge datasets

keep empty datatable with id, and each time user add new column, marge first datatable with new datatable containing id and new column

But in your case, I think it will be better to bind full datatable to grid, and change visible of or add remove datagrid column depending user action

Upvotes: 1

Related Questions