PC Review


Reply
Thread Tools Rate Thread

Probem with DataSet.GetXml()

 
 
lucky
Guest
Posts: n/a
 
      26th Oct 2006
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

 
Reply With Quote
 
 
 
 
Lucky
Guest
Posts: n/a
 
      26th Oct 2006
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

lucky wrote:
> 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


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
probem opening c drive anon@where.comlovely Windows XP Help 4 8th May 2005 01:13 PM
Folder Probem =?Utf-8?B?Q0JldHJv?= Windows XP Help 3 14th Feb 2005 05:54 PM
CD burning probem in windowsXP =?Utf-8?B?UHJlZXQgR2lsbC1LdW1hcg==?= Windows XP Help 1 4th Sep 2004 06:56 PM
Network probem with Compaq Laptop SDR Windows XP Networking 3 13th Oct 2003 02:43 AM
home network probem Mylo Windows XP Networking 0 27th Aug 2003 07:46 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:48 AM.