• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 65
  • 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
Cloud Class® Course: Microsoft Exchange Server

The MCTS: Microsoft Exchange Server 2010 certification validates your skills in supporting the maintenance and administration of the Exchange servers in an enterprise environment. Learn everything you need to know with this course.

 
Jacques Bourgeois (James Burger)PresidentCommented:
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Certified Penetration Testing

This CPTE Certified Penetration Testing Engineer course covers everything you need to know about becoming a Certified Penetration Testing Engineer. Career Path: Professional roles include Ethical Hackers, Security Consultants, System Administrators, and Chief Security Officers.

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