Serialize a DataTable

Z

Zanna

Hi all!

I have to serialize the data (and possbly the structure) contained into a
dataTable.

I did this for a desktop app and it works

Dim stream As New System.IO.FileStream(Omega.Basic.Utility.App.DataPath +
"\" + tableName + ".xml", IO.FileMode.Create)

Dim formatter As New
System.Runtime.Serialization.Formatters.Binary.BinaryFormatter()

formatter.Serialize(stream, Me.Tables(tableName))

stream.Close()


But it seems that the CF does not have the BinaryFormatter class.

How can I serialize a datatable with then CF?

Thanks!
 
A

Alex Yakhnin [MVP]

Hmm... from the page on the web site:

"This package contains CompactFormatter's precompiled binaries for the
Compact Framework and for the .NET Framework plus full source-code and NDoc
generated documentation..."
 
I

Ignacio Machin \( .NET/ C# MVP \)

Hi,


Another solution is include the DataTable in a dataset and serialize the
dataset as a XML file. It works out of the box :)

Cheers,
 

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

Top