Serialize a DataTable

  • Thread starter Thread starter Zanna
  • Start date Start date
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!
 
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..."
 
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,
 
Back
Top