daset problem

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");
 
L

Lateralus [MCAD]

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
 

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