473,394 Members | 1,794 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

storing serialized object in DB problem

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

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


Nov 18 '05 #1
1 906
Try converting your stream into a byte array, and storing the byte array.
something like this:
CType(currentStream, Byte())

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net

"Marcel Balcarek" <ma*************@REM-OVEMEtoxicall.com> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
I have serialized an object:
Dim formatter As New
System.Runtime.Serialization.Formatters.Binary.Bin aryFormatter

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

Nov 18 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

14
by: mjkahn | last post by:
I've read (and read!) that you shouldn't store objects in Session variables. I've read these reasons: - The object takes up memory that may not be freed until the session times out. Better to...
0
by: Ray Mitchell | last post by:
Hello, The result of auto-converting some Java code to C# yielded the following upgrade issue regarding the original Java call to "reset()": public virtual void writeObj(Object obj) {...
10
by: Diego F. | last post by:
Hello. I need to store custom objects in a SQL Server 2000 table. Which is the easiest way to do it? Do I need to write methods to store each attribute separately from C# app to the table and the...
4
by: Joe | last post by:
This my seems stupid because it should be very obvious but I'm going to ask anyway... I have a class MyCollection which inherits from CollectionBase and another class MyObject which is stored in...
3
by: yop | last post by:
Hello I have an application, Login page, enter UserName & Password. Function in Users called GetUserDetails and checks the details and if they are valid calls a function to fill the following...
1
by: Marcel Balcarek | last post by:
I have serialized an object: Dim formatter As New System.Runtime.Serialization.Formatters.Binary.BinaryFormatter Dim currentStream As New System.IO.MemoryStream ...
2
by: nacho222 | last post by:
I'm currently in the middle of writing a persistence framework, and I have to make a design decission. The framework will take care of all the saving and restoring objects, and also the...
10
by: Mark Rae | last post by:
Hi, This relates to the previous thread "Disappearing Sessions", but is a bit more generic so I thought I'd start a new thread. This one relates to the storing of objects in Session once only to...
9
by: PI | last post by:
Hi Guys, I need some assistance with the following scenario please. I know this might be more of a MySQL post than a PHP one, but it is likely some developer has been here before and would be...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.