daset problem

  • Thread starter Thread starter Rob Morgan
  • Start date Start date
R

Rob Morgan

Does anyone know why the only xml output of this is
<Names />?

DataSet myDS1 = new DataSet("Names");
if (!System.IO.File.Exists("ClassNames.xml"))
{
DataTable myDT1 = myDS1.Tables.Add("ClassNames");
DataColumn myDC1 = myDT1.Columns.Add("TableName", typeof
(String));
myDT1.Columns.Add("ClassName", typeof(String));
myDT1.Columns.Add("PluralName", typeof(String));
myDT1.PrimaryKey = new DataColumn[] {myDC1};

myDS1.WriteXml("ClassNames.xml");
}
myDS1.ReadXml("ClassNames.xml");
 
Rob,
Because that is what you named the dataset. Also, there are no rows in
your datatable. If you want an xml schema defenition make a call to
WriteXmlSchema instead.

HTH
 
Back
Top