I am trying to figure out how to perfom a SQL join on a dataset in VB.NET WInforms. In my SQL SERVER database, I have these 3 tables (fields simplified):
T1 (ID, colA)
T2 (ID, ID2, colB)
T3 (ID2, colC)
and view vwFinal, which is defined as:
SELECT ID, ID2, colA, colB, colC
FROM T1 INNER JOIN T2. on T1.ID = T2.ID
INNER JOIN T3 on T2.ID2 = T3.ID2
(BTW, the second INNER JOIN actually has a double JOIN ... join on 2 different identity fields)
In my VB.NET Winforms application, I have connected to the Development database, and created a strongly-typed dataset ds with the 3 tables and the single view. The accompanying tableadapters have been automatically created.
In the Production version of the databse, I would like like to leave out the view.
I am able to fill the 3 tables with the table adapters, but instead of allowing the database server to perform the JOIN as above to fill the vwFinal, can I do it in VB.NET code so that I can insert the results of the JOINed rows into the ds.vwFinal datatable so that I can:
1) display the data in a DataGrid View
2) display the results in a Report.
I have heard of using LINQ to SQL, but I could not find an easy example. Is there a relatively easy way to handle this?