Solved

VB.net Join two data tables

Posted on 2014-02-09
5
1,521 Views
Last Modified: 2014-02-09
Is it possible to join two data tables?
0
Comment
Question by:murbro
  • 2
  • 2
5 Comments
 
LVL 142

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 39845361
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
 

Author Comment

by:murbro
ID: 39845380
Hi
I want to do a SQL join.
Thanks
0
 
LVL 142

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 39845387
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
 
LVL 69

Accepted Solution

by:
Éric Moreau earned 500 total points
ID: 39845402
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
 

Author Closing Comment

by:murbro
ID: 39845576
Thanks very much. I am going to be doing this with a variety of tables
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: jpaulino
XML Literals are a great way to handle XML files and the community doesn’t use it as much as it should.  An XML Literal is like a String (http://msdn.microsoft.com/en-us/library/system.string.aspx) Literal, only instead of starting and ending with w…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
In this video I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: http://www.codetwo.com/backup-for-office-365/ (http://www.codetwo.com/ba…

912 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now