Merge Columns from different DataTables?

  • Thread starter Thread starter Guest
  • Start date Start date
If there is a common field you can use a DataRelation object
http://www.knowdotnet.com/articles/datarelation.html .
Otherwise you may want to create a query or a view that joins the table and
brings them over as a DataTable. The other alternative is to create a new
DataTable and copy the columns/rows from both tables into a new table.
AFAIK, there's not a clean or elegant way to do it unless you can establish
a DataRelation.

HTH,

Bill
 
thanks.. follow up question:
if i create a new table with the info from both tables, then bind the new table to a datagrid, how do i ensure that values in the original 2 tables will also change along with the changes in the newly created table

thank
 
Hi Sub:

Trap a grid event like current cell changed or a datatable event like
Rowchanged and when this is fired, check what column (DataGrid.CurrentCell
has both a Row and Column Index) and row were changed..this will give you a
reference to change the original datatable. This is starting to get a
litttle complex though..I'd probably still opt for finding a common field
between the two tables and using a DataRelation
SubT said:
thanks.. follow up question:
if i create a new table with the info from both tables, then bind the new
table to a datagrid, how do i ensure that values in the original 2 tables
will also change along with the changes in the newly created table.
 
Back
Top