storing serialized object in DB problem

  • Thread starter Thread starter Marcel Balcarek
  • Start date Start date
M

Marcel Balcarek

I have serialized an object:
Dim formatter As New
System.Runtime.Serialization.Formatters.Binary.BinaryFormatter

Dim currentStream As New System.IO.MemoryStream

formatter.Serialize(currentStream, Me._testKey)

I then set my datarow varBinary column to currentStream:

currentDataRow("Data") = currentStream

Then I try the DB insert, which fails with: [FormatException: Index (zero
based) must be greater than or equal to zero and less than the size of the
argument list.]

What am I doing wrong?
Please help if you can.
Marcel
 
Try converting your stream into a byte array, and storing the byte array.
something like this:
CType(currentStream, Byte())
 
Back
Top