How to filter a Dataset and save it into Xml ?

  • Thread starter Thread starter Patrice Dargenton
  • Start date 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.
 
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)
 
Back
Top