Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

VB.net Join two data tables

Posted on 2014-02-09
5
Medium Priority
?
2,286 Views
Last Modified: 2014-02-09
Is it possible to join two data tables?
0
Comment
Question by:Murray Brown
  • 2
  • 2
5 Comments
 
LVL 143

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:Murray Brown
ID: 39845380
Hi
I want to do a SQL join.
Thanks
0
 
LVL 143

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 70

Accepted Solution

by:
Éric Moreau earned 2000 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:Murray Brown
ID: 39845576
Thanks very much. I am going to be doing this with a variety of tables
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

This article explains how to create and use a custom WaterMark textbox class.  The custom WaterMark textbox class allows you to set the WaterMark Background Color and WaterMark text at design time.   IMAGE OF WATERMARKS STEPS Create VB …
Introduction When many people think of the WebBrowser (http://msdn.microsoft.com/en-us/library/2te2y1x6%28v=VS.85%29.aspx) control, they immediately think of a control which allows the viewing and navigation of web pages. While this is true, it's a…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…

916 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