Select into new Datatable from Datatables

D

Daniel

Hi
I have searched vbcity and the internet for a solution for my question
but with no luck. But I am sure it must be simple to accomplish?

I have to Datatables, DT1 and DT2, already populated from database.

What I want to do is to select data from two (or more) datatables (in
memory) into a new datatable.

I have solved the problem constructing a new SQL query (from the info
in the two tables) and sending it to the database but I want to save
the trip to the database since all the data is already in memory in
the two tables.

I have also solved it looping through the datatables and populating a
new datatable row by row, item by item, but that seems unnecessary and
slow also.

I want to do a JOIN from these two tables and put the results into a
new Datatable:

Something like this:
DT3 = SELECT DT1.col1, DT2.col2 FROM DT1, DT2 WHERE DT1.col1 =
DT2.col1 AND DT2.col2 > 10

I have looked into the Dataset and Datatable objects with no luck. How
do I use the datatables/dataset as a datasource to query?

Thanks!

Daniel
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top