PC Review


Reply
Thread Tools Rate Thread

Convert DataTable to Xml string variable...

 
 
Matthew Wells
Guest
Posts: n/a
 
      23rd Feb 2008
Hello,

I'm using C# behind an aspx file. I'm trying to find a way to convert a
datatable to xml and assign that to a string variable without saving to a
file. Obviously I don't want to slow down the process by writing to disk,
but all the methods I've found so far (datatable.writexml) write to a file.
I think there's a way to use a stream object, but I haven't come up with
anything. How can I get this done without writing to disk?

Thanks.

Matthew Wells
(E-Mail Removed)


 
Reply With Quote
 
 
 
 
Michael Nemtsev [MVP]
Guest
Posts: n/a
 
      24th Feb 2008
Hello Matthew,

Did you try to use StringWriter for your datatable.writexml ?

---
WBR,
Michael Nemtsev [.NET/C# MVP] :: blog: http://spaces.live.com/laflour

"The greatest danger for most of us is not that our aim is too high and we
miss it, but that it is too low and we reach it" (c) Michelangelo


MW> Hello,
MW>
MW> I'm using C# behind an aspx file. I'm trying to find a way to
MW> convert a datatable to xml and assign that to a string variable
MW> without saving to a file. Obviously I don't want to slow down the
MW> process by writing to disk, but all the methods I've found so far
MW> (datatable.writexml) write to a file. I think there's a way to use a
MW> stream object, but I haven't come up with anything. How can I get
MW> this done without writing to disk?
MW>
MW> Thanks.
MW>
MW> Matthew Wells
MW> (E-Mail Removed)


 
Reply With Quote
 
Peter Bromberg [C# MVP]
Guest
Posts: n/a
 
      24th Feb 2008
Just create a new MemoryStream object and use that as the stream overload
parameter.
-- Peter
Site: http://www.eggheadcafe.com
UnBlog: htp://petesbloggerama.blogspot.com
Short Urls & more: http://ittyurl.net


"Matthew Wells" wrote:

> Hello,
>
> I'm using C# behind an aspx file. I'm trying to find a way to convert a
> datatable to xml and assign that to a string variable without saving to a
> file. Obviously I don't want to slow down the process by writing to disk,
> but all the methods I've found so far (datatable.writexml) write to a file.
> I think there's a way to use a stream object, but I haven't come up with
> anything. How can I get this done without writing to disk?
>
> Thanks.
>
> Matthew Wells
> (E-Mail Removed)
>
>
>

 
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
convert string to datatable Hemant Microsoft ASP .NET 1 14th Oct 2009 08:33 AM
Convert DataTable to Xml string variable... Matthew Wells Microsoft C# .NET 7 7th May 2008 06:13 AM
Concatenate without string or convert string to variable =?Utf-8?B?U1NCU3lzdGVtc0NsZXJr?= Microsoft Access Form Coding 5 6th Apr 2006 11:46 PM
Connection String object Convert to String Variable Type =?Utf-8?B?TWlrZSBNb29yZQ==?= Microsoft ASP .NET 2 26th Oct 2004 03:43 PM
How do I convert an integer variable to a string variable? =?Utf-8?B?ZHVtYmFzcw==?= Microsoft Excel Programming 2 21st May 2004 07:34 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:43 AM.