Actually, throw out the try catch block.  I don't know what I was thinking putting 
that in there.

-----Original Message-----
From: Karen Healey [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, June 04, 2002 3:30 PM
To: [EMAIL PROTECTED]
Subject: Re: [DOTNET] XML to string and vice versa


Thank you!  That worked.  I haven't played with System.IO.StringReader so I
assumed that I could not use DataSet.ReadXML.

Thanks again!

Karen


----- Original Message -----
From: "franklin gray" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, June 04, 2002 15:20
Subject: Re: [DOTNET] XML to string and vice versa


such as

    Public Function CreateDS(ByRef XMLString As String) As DataSet
        Try
            '   Create Dataset from xml string
            Dim oDS As New DataSet()
            Dim MyStringReader As System.IO.StringReader
            Dim MyTextReader As Xml.XmlTextReader

            MyStringReader = New System.IO.StringReader(XMLString)
            oDS.ReadXml(MyStringReader, XmlReadMode.Auto)
            Return oDS
        Catch e As Exception
            Throw e
        End Try
    End Function

-----Original Message-----
From: Jon Finley [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, June 04, 2002 2:11 PM
To: [EMAIL PROTECTED]
Subject: Re: [DOTNET] XML to string and vice versa


Karen,

Try Dataset.ReadXml

Jon Finley

> -----Original Message-----
> From: Karen Healey [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, June 04, 2002 2:13 PM
> To: [EMAIL PROTECTED]
> Subject: [DOTNET] XML to string and vice versa
>
>
> Hi,
>
> I've created a dataset and then I write the dataset to a
> database by taking the XML string of the dataset and storing
> that as one column in the database (because the dataset is variable).
>
> In other words, I call GetXml on the dataset, and store this string.
>
> Now I want to go the other way... I want to take the string
> and convert it back to a dataset but there doesn't seem to be
> an easy way to do this. What I'm doing is loading it into an
> XML document like follows:
>
>  string XMLData = myDataView[0].Row["XMLData"].ToString();
>  XmlDataDocument myXMLData = new XmlDataDocument();
> myXMLData.LoadXml(XMLData);
>
> Then I iterate through the data document and rebuild the dataset.
>
> It seems to me that if it was so simple to call GetXml on a
> dataset, there should be some simple way of getting the Xml
> back into a dataset.  Maybe I'm missing something.
>
> FYI... the ultimate goal is to display it in a datagrid so I
> would be happy to skip the dataset altogether.
>
> Thank you,
>
> Karen
>
> You can read messages from the DOTNET archive, unsubscribe
> from DOTNET, or subscribe to other DevelopMentor lists at
> http://discuss.develop.com.
>

You can read messages from the DOTNET archive, unsubscribe from DOTNET, or
subscribe to other DevelopMentor lists at http://discuss.develop.com.

You can read messages from the DOTNET archive, unsubscribe from DOTNET, or
subscribe to other DevelopMentor lists at http://discuss.develop.com.

You can read messages from the DOTNET archive, unsubscribe from DOTNET, or
subscribe to other DevelopMentor lists at http://discuss.develop.com.

You can read messages from the DOTNET archive, unsubscribe from DOTNET, or
subscribe to other DevelopMentor lists at http://discuss.develop.com.

Reply via email to