Probem with DataSet.GetXml()

L

lucky

Hi guys!
i'm facing very strange problem.

i've a DataSet object in which i add some tables the some logic
finishes successfully. and after then i tried to get the XML string
from the DataSet but it returns only first 2 tables in that string.

here is the code that i'm using to add tables into the DataSet and then
tried to get the xml from the dataset

please note that i'm manually adding tables into the DataSet.
foreach (SQLTransaction t in Trans)
{
System.Data.DataSet ds;
ds = t.Execute();
if (ds != null)
{
foreach (System.Data.DataTable table in
ds.Tables)
{
dsResult.Tables.Add(table.Copy());
}
}
}

Gettting the xml from the dataset

dsResult.AcceptChanges();
string xml=dsResult.GetXml();

when i get the string from the dataset it returns xml of the first 2
tables regardless, it has more then 3 tables.

if anyone know where i'm making mistake, plesae let me know.

all suggestions,modification,alternate ways are welcome.

thanks,
Lucky
 
L

Lucky

okey i've got the answer.

the DatSet wont produce xml for those tables, those doesnt have any
rows. If you still need xml, u have to use DataTable.WriteXml() method.

Have a nice day,
Lucky
 

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

Members online

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,567
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top