How to filter a Dataset and save it into Xml ?

  • Thread starter Patrice Dargenton
  • Start date
P

Patrice Dargenton

Hello, I can save my DataSet into Xml using ds.WriteXml(strXmlPath).
Now I would like to filter it like I can do using DataView.RowFilter into
another Xml file, but I don't know how to do it, because It always contains
the original DataSet, not the filtered one, any solution ?
Thanks.
 
P

Patrice Dargenton

It works fine, thanks a lot !

Dim dvFiltered As New DataView(ds.Tables(sMyTable))
dvFiltered.RowFilter = sMyCriteria
Dim dtFiltered As DataTable = dvFiltered.Table.Clone
For Each dvr As DataRowView In dvFiltered
dtFiltered.ImportRow(dvr.Row)
Next dvr
Dim dsFiltered As New DataSet
dsFiltered.Tables.Add(dtFiltered)
dsFiltered.WriteXml(sMyPath)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top