> T,
>
[quoted text clipped - 28 lines]
> > Thanks in advance,
> > Ted
Good idea, I'll start again, no sense fixing a problem with the path
I'm on if it's the wrong path!
I'm reading XML files that provide status information on a system I'm
working with that get updated periodically on a website I do not
control. I can access the website to see if the file has been
updated, and if it has, I open a stream on it using the above code.
I use the information to populate XmlDataSources that are bound to a
gridView. Additionally, I want to be able to populate a DataSet with
this information that works with another object that does Statistics,
etc., and I'm currently using the ReadXml method on the dataset to
populate it. So I have a stream, and to populate the XmlDataSource, I
create a streamReader and use the ReadToEnd() method to get a string
of data that I then assign to XmlDataSource.Data.
But here I want to rewind the stream (or Seek(0,Begin)), so I can then
populate the Dataset as well using the ReadXml method. ReadXml takes
a stream, a TextReader, an XmlReader or a string defining the file to
open. My ISO won't let me save the data as a file on their server.
Is there a way to do this? (That was my original question.) Or, is
there a way to populate the XmlDataSource with a Dataset? (That's a
new question)
I know I could add all the data to a DB, then requery, but I was
hoping there is a simpler way for this seemingly simple problem.
Thanks for your help,
Ted
PlatinumBay - 07 Jun 2007 15:16 GMT
Ted,
Ok, what about something like this?
Stream newStream = myWebClient.OpenRead(myStringWebResource);
TextReader newReader = new StreamReader(newStream);
string newData = newReader.ReadToEnd();
XmlDataSource xmld = new XmlDataSource();
xmld.Data = newData;
DataSet ds = new DataSet;
IO.StringReader tr = new IO.StringReader(newData);
ds.ReadXml(tr);
...
(remember to dispose your stream/reader objects)
Hope this helps,
Steve
>> T,
>>
[quoted text clipped - 53 lines]
> Thanks for your help,
> Ted
T Driver - 07 Jun 2007 15:49 GMT
> Ted,
>
[quoted text clipped - 16 lines]
>
> Steve
That's it! Exactly what I was looking for - works like a charm.
thanks a million Steve,
Ted