I am attempting to generate an XML file based on the contents of a dataset
which contains a parent-child relationship but when I create the output file
all I get is the XML header as shown here:
<?xml version="1.0" encoding="utf-8"?>
<DataSet xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true" />
I know the dataset and the relationship is OK as I have the dataset bound to
datagrids which are showing the correct data.
The dataset is named "ds1", the relationship is defined as shown below. Does
anyone have an idea of what I am doing wrong here?
Wayne
============= Relationship ====================
Dim ShowColumns() As DataColumn
Dim PerfColumns() As DataColumn
ShowColumns = New DataColumn() {ds1.Tables(0).Columns("RegionalID"),
ds1.Tables(0).Columns("SeqNbr")}
PerfColumns = New DataColumn() {ds1.Tables(1).Columns("RegionalID"),
ds1.Tables(1).Columns("SeqNbr")}
Dim ShowSetsRel As New DataRelation("ShowSets", ShowColumns, PerfColumns)
'Add the Relation to the DataSet
ds1.Relations.Add(ShowSetsRel)
ShowSetsRel.Nested = True
============ XML Output code ================
Private Sub SerializeDataSet(ByVal filename As String)
Dim ser As XmlSerializer = New XmlSerializer(GetType(DataSet))
Dim writer As TextWriter = New StreamWriter(filename)
ser.Serialize(writer, ShowSets) '<= I've trid the name of the
dataset (ds1) and the Relationship object (ShowSetsRel ) - all give no
output
writer.Close()
End Sub