• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 61
  • Last Modified:

Help with with exporting data from Datatable to xml using VB.NET

Hi,

How do I modify the code below to export the data from the data table XML?

        Dim GGB As String
        GGB = "'" & ComboBox2.SelectedItem & "'"
        Dim SearchCriteriaZ As String = "COUNTRY IN (" & GGB & ")"
        xmlPath1 = System.IO.Path.Combine(Application.StartupPath + "\AOP40.xml")  'grid1
        dtsetcol1.Clear()
        dtsetcol1.ReadXml(xmlPath1)
        Dim FilteredDTA As DataTable
        Dim DVA As New DataView(dtsetcol1.Tables(0), SearchCriteriaZ, Nothing, DataViewRowState.CurrentRows)
        DVA.Sort = "SN"
        FilteredDTA = DVA.ToTable
        Me.C1Screen1.DataSource = FilteredDTA
     

Open in new window


Thanks,

Victor
0
vcharles
Asked:
vcharles
  • 3
  • 2
1 Solution
 
Shane KahkolaDirector of I.T.Commented:
Try This:
FilteredDTA.WriteXML(Application.StartupPath + "\AOP40.xml")

Open in new window

0
 
vcharlesAuthor Commented:
Hi,
I tried it but it didn't  work. Seem to work from a dataset but not a table, is there away to convert the data table to a dataset to use the code.
Victor
0
 
Shane KahkolaDirector of I.T.Commented:
Dim ds As New Dataset()
ds.Tables.Add(datatable)

Open in new window

0
Granular recovery for Microsoft Exchange

With Veeam Explorer for Microsoft Exchange you can choose the Exchange Servers and restore points you’re interested in, and Veeam Explorer will present the contents of those mailbox stores for browsing, searching and exporting.

 
Jacques Bourgeois (James Burger)Commented:
Are you still programming for framework 1.0 or 1.1

WriteXML was not supported on a DataTable in these versions, but has been since 2.0 (Visual Studio 2005).

If you are still on an old version, do yourself a favor and move to a newer version of Visual Studio and the framework. You can have the Express version for free if you program only from time to time, but if you are a professional and work in a group of 5 programmers or less, you can get the Community Edition, that is a free edition of the Professional.
0
 
vcharlesAuthor Commented:
Hi, I'm using Framework 4.0, code from previous post works.

Thanks.
0
 
vcharlesAuthor Commented:
Thank You.
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

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.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now