Daniel Montiagudo
Daniel Montiagudo

Reputation: 15

is there a way to join datatables?

I have two datatables that comes from different database servers, the first looks like this:

structure from first dataTable

it shows how many clients each salesperson visited in the specified date.
The second dataTable looks like this:

structure of second dataTable

it shows how many customer the saleperson was supposed to visit.

As i said this data comes from two different servers, i need to do something like a join in database with the key fields (SLPRSNID AND DAYOFWEEK) in order to show in a report the compliance percentage of each salesperson.

My report application is made in VB.NET for desktop environment. Thanks in advance
btw sorry for my bad english

Upvotes: 1

Views: 91

Answers (2)

GMan80013
GMan80013

Reputation: 536

You can use linq to datasets to accomplish what you are looking for, if that is to get the two datatables into one flattened result set. See this for a description and example: Cross Table Query of Datatables

If you want to maintain a relationship for some reason, consider designing a dataset with the two datatables and a data relation to join them. That will create functions to GetChildRows from the parent, and GetParentRow from the children.

Update #1 - Try this to convert your query result into a datatable. Creating a DataTable From a Query

Dim boundTable As DataTable = query.CopyToDataTable() 

Upvotes: 1

PNP
PNP

Reputation: 371

Found out Merge(DataTable) Method from MSDN. Hope it will solve your problem Merge()

Also #SSS suggested answer can be accepted for your problem

Upvotes: 1

Related Questions