problem de-serializing a dataset

M

MattB

I have a dataset that originated as a string (passed from a C++ dll). I
de-serialize it, use the data, and then in some cases I will serialize it
again to pass as a session variable in my app and then de-serialize it
again. This generally works well, but I just hit a problem de-serializing
it. I have a vb class set up with commonly used code and have functions to
handle serialization and de-serialization.

Suddenly, I'm hitting the error:
The 'urn:schemas-microsoft-com:rowset:data' element is not declared. An
error occurred at , (9, 12).
with a dataset that has already successfully gone through this process. Not
sure what's going wrong or how to approach the troubleshooting.
Anyone got any ideas?
Thanks!

Here's that code that does the serialization/de-serialization:

Public Shared Function SerializeDS(ByVal ds As DataSet)
Dim MyXMLWriter As New System.IO.StringWriter, str As String

ds.WriteXml(MyXMLWriter, XmlWriteMode.WriteSchema)

str = MyXMLWriter.ToString()

MyXMLWriter.Close()

MyXMLWriter = Nothing

Return str

End Function

Public Shared Function deSerializeDS(ByVal xml As String)

Dim ds As New DataSet

If Not IsNothing(xml) Then

Dim XMLRead As New System.IO.StringReader(xml)

ds.ReadXml(XMLRead)

XMLRead.Close()

XMLRead = Nothing

End If

Return ds

End Function
 

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,774
Messages
2,569,596
Members
45,135
Latest member
VeronaShap
Top