Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

VB.net Join two data tables

Posted on 2014-02-09
5
Medium Priority
?
2,135 Views
Last Modified: 2014-02-09
Is it possible to join two data tables?
0
Comment
Question by:Murray Brown
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

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 …
If you're writing a .NET application to connect to an Access .mdb database and use pre-existing queries that require parameters, you've come to the right place! Let's say the pre-existing query(qryCust) in Access takes a Date as a parameter and l…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
Suggested Courses

705 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