Quantcast
Channel: VBForums
Viewing all articles
Browse latest Browse all 16039

VS 2019 Merge Two DataTables in a DataSet

$
0
0
I have a two Datasets called DSMonitors and DSPings. Inside DSMonitors I have a data table called DTMonitors. Inside DSPings I have a data table called PingTable.

DTMonitors
- Monitor_ID
- Device_Name
- Monitor_Protocol
PingTable
- Monitor_ID
- Result
- Timestamp
- Count

The idea is to combine the two data tables so I can display it in a DataGridView.

First, I load the data from the XML files.
Code:

        If My.Computer.FileSystem.FileExists(FRMMain.xmlMonitorsFile) Then
            DSMonitors.ReadXml(FRMMain.xmlMonitorsFile)
        End If

        If My.Computer.FileSystem.FileExists(FRMMain.xmlPingFailFile) Then
            DSPings.ReadXml(FRMMain.xmlPingFailFile)
        End If

        DSMonitors.Merge(DSPings)

When debugging, if I were to look at the columns property of DSMonitors it doesn't have the Columns of DSPings. So I'm under the impression that the tables need to match up and then Merge is just for the data itself. Both DataTables share a unique column. I see plenty of examples when it comes to SQL Query but I'm loading my data from XML files. What's the proper way to go about this? Any assistance?

Viewing all articles
Browse latest Browse all 16039

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>