storing serialized object in DB problem

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
 
S

Steve C. Orr [MVP, MCSD]

Try converting your stream into a byte array, and storing the byte array.
something like this:
CType(currentStream, Byte())
 

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

Forum statistics

Threads
473,734
Messages
2,569,441
Members
44,832
Latest member
GlennSmall

Latest Threads

Top