David,
WriteXml writes the entire dataset.
What you need to do is "Create" a dataset that only has a records for a
specific area, then write this dataset.
You can use DataSet.Clone to create a copy of the structure of a DataSet,
without any of the data.
While DataSet.Copy creates a copy of the structure of a DataSet, including
all of the data.
Depending on the amount of data I was keeping verses getting ride of. I
would either Clone the data set, and then use DataTable.ImportRow to import
only my desired data. Or I would use DataSet.Copy & then use DataRow.Delete
to remove the undesired rows. If you have relationships with cascading
deletes, the DataRow.Delete might be the "simpler" solution, albeit more
memory intensive.
The "Trick" with the DataTable.ImportRow is going to be to get all the
parent rows needed... If you have a common id across tables (area?) then you
could just import parent tables for an area first, and then child tables. If
not, I would import the child table, and import the parent row "as needed".
Post if you would like code samples.
Alternatively, you might be able to use DataSet.GetChanges. However this
might be considered a "HACK". Basically you would modify your customers for
an area, then call GetChanges...
Hope this helps
Jay
"David Richards" <da************@tools.co.uk> wrote in message
news:un**************@TK2MSFTNGP10.phx.gbl...
| Hi,
|
| I was wondering if anyone could help me. I have DataSet that contains
| the following data tables Customers, Calls, Quotes, QuoteDetails,
| Competitors, Contacts, Notes, and I have setup relationships
| betweenthem. Each row in the customer's data table contains an area
| number.
|
| What I would like to do is export all records for specific area to an
| XML file.
|
| Is there anyway to use the DataSet objects WriteXML method to do this. I
| have looked at the documentation and cannot find any example of using
| WriteXml to export a part of a dataset.
|
| If it is not possible to do this using WriteXMl, can anyone recommend
| another way? I am new at VB.NET, and any help would be really
| appreciated.
|
| Thanks in advance
| Dave
|
|
| *** Sent via Developersdex
http://www.developersdex.com ***