Maintaining relation between two tables when transferring records

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi

I have two identical tables - same field names, identical datatypes(the tables are in different databases) and same
constraints

I need to transfer a record from one table to the other. While doing the transfer, the column names are to be
checked so that the right column data gets inserted into the other.
Though the column names are identical their order may be different in the tables

My thinking is having two data adapters and datasets and then do some sort of comparison of column names before I go ahead with the data insertion. Does that sound ok ?

Is there some other easy way ?

Thank
Bill
 
Hi Bill,

Once the data is loaded you might consider using
DataTable.LoadDataRow, NewRow or ImportRow method to transfer a single row.
For merging entire DataTable you should see DataSet.Merge method.

--
Miha Markic [MVP C#] - RightHand .NET consulting & software development
miha at rthand com
www.rthand.com

Bill said:
Hi,

I have two identical tables - same field names, identical datatypes(the
tables are in different databases) and same
constraints.

I need to transfer a record from one table to the other. While doing the
transfer, the column names are to be
checked so that the right column data gets inserted into the other.
Though the column names are identical their order may be different in the tables.

My thinking is having two data adapters and datasets and then do some sort
of comparison of column names before I go ahead with the data insertion.
Does that sound ok ?
 
Back
Top