Link to home
Start Free TrialLog in
Avatar of Dnx_7
Dnx_7Flag for Belgium

asked on

How to merge 2 datatable and exclude data

Hi experts

i have 2 database
i make a query on the first and i have, let's say this datatable :

ID (int) | Label (string)

I make another query on the other database and i have this datatable :

ID (int) | Label (string | X (int) | Y (int)


and i want to create a unique dataset or datatable that contains all result from the first datatable without the result of the second datatable based on ID

is it possible?

thank you

regards
Avatar of Dirk Haest
Dirk Haest
Flag of Belgium image

' Assuming you have similar data structures, you can merge the DataTables using
' the DataSet's Merge method, like this:

' Create a DataSet so I can merge the DataTable objects
Dim oDs As New DataSet("MyFunDataSet")
oDs.Tables.Add(sourceTable)
oDs.Merge(destinationTable)

'The Merge method will add the rows to the destimation table if it does not
'find a matching primary key.
ASKER CERTIFIED SOLUTION
Avatar of athapa
athapa

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial