Quantcast
Viewing all articles
Browse latest Browse all 27080

VS 2010 What's the easiest method of exporting my data to XML?

I'm pulling data from an Access database and placing it into a DataGridView. This is my code:

Code:

Private Sub PopulateGrid(ByVal sqlQuery As String, ByVal grid As DataGridView)

        ' This connection string
        Dim ConnectionString As String = "Provider = microsoft.ace.oledb.12.0; Data Source=|DataDirectory|/workout_tracker.accdb"

        ' Creates and uses an oledb data adapter
        Using adapter As New OleDbDataAdapter(sqlQuery, ConnectionString)

            ' Creates the data table
            Dim table As New DataTable

            ' Fills the data table with the adapters records
            adapter.Fill(table)

            ' Sets the data grid's data source to the data table
            grid.DataSource = table

        End Using
    End Sub

Is there any way I could simply export the DataTable to XML? What's the best method of doing this?

I'm still researching right now, but I also wanted to ask your opinions.

Thank you very much :)

Viewing all articles
Browse latest Browse all 27080

Trending Articles



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