user1295053
user1295053

Reputation: 303

Datatables VB.Net

I have 2 datatables

Table 1 (Type6) has fields: StopNo

Table 2 (StationName) has fields: StopNo, Name

What I want to do is to join the 2 tables, so in sql it would be this:

SELECT DISTINCT Type6.STOPNO, StationName.NAME FROM Type6 JOIN StationName on StationName.STOPNO=Type6.STOPNO order by NAME"

How do I do this with 2 datatables holding the same information?

Upvotes: 0

Views: 247

Answers (1)

John Bustos
John Bustos

Reputation: 19574

... Let me know if this does the trick...

    Dim Result = (From tp6 As DataRow In Type6
             Join stNm As DataRow In StationName
             On tp6.Item("STOPNO") Equals stNm.Item("STOPNO")
             Select x = New With {.STOPNO = tp6.Item("STOPNO"), .NAME = stNm.Item("NAME")}).Distinct

Upvotes: 1

Related Questions