Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2457
  • Last Modified:

VB.net Join two data tables

Is it possible to join two data tables?
0
Murray Brown
Asked:
Murray Brown
  • 2
  • 2
1 Solution
 
Guy Hengel [angelIII / a3]Billing EngineerCommented:
please clarify if you want to "append" the 2 data tables or if you want to do indeed a "SQL Join" ...

anyhow, first one is to be found easily by checking the Merge method of the datatable.
second one is "easily" with Linq statements, though other methods exists.
of course, if the underlying data is coming from the same database, you could indeed think about doing the "join" in sql directly...
0
 
Murray BrownMicrosoft Cloud Azure/Excel Solution DeveloperAuthor Commented:
Hi
I want to do a SQL join.
Thanks
0
 
Guy Hengel [angelIII / a3]Billing EngineerCommented:
you use a dataview and datarelation object to do so, see here for the starting syntax:
http://msdn.microsoft.com/en-us/library/fa04ha86%28v=vs.110%29.aspx
0
 
Éric MoreauSenior .Net ConsultantCommented:
It would be useful to have the tables structure. Do you want INNER or LEFT join?

The query will be something like:

select *
from Table1 as T1
INNER join Table2 as T2
ON T2.CommonField = T1.CommonField
0
 
Murray BrownMicrosoft Cloud Azure/Excel Solution DeveloperAuthor Commented:
Thanks very much. I am going to be doing this with a variety of tables
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now