.NET Framework Bookmark and Share   
 index > .NET Remoting and Runtime Serialization > Problem in Serilaizing objects with Binary Formatters
 

Problem in Serilaizing objects with Binary Formatters

Hi
I am storing a serialized data in to database (SQL server 2005) using Memory streams and Binary Formatters. The data that is being serialized is a structure data. The problem I am facing is every time I try to insert a structure instance , it is not inserted . Instead the instance which I enterd in to the data base for the first time itself is getting inserted again and again... please find me the bug in d code .. I am using varbinary(MAX) field in database.

The part of My code is :



byte[]_array;
MemoryStreamms=newMemoryStream();
BinaryFormatterb=newBinaryFormatter();
//thisisproboccurs.
b.Serialize(ms,vector);//vectoristhestrucureinstanceiamserializing..
ms.Seek(0,0);
_array=ms.ToArray();//thenewinstanceisnotbeingserializedinsteaddoldenteredinstanceonlyisstoredinthearray
ms.Close();


Thanks in advance........
Priya87
Hi Priya -- I'm a little confused by your question. You talk a lot about wanting to do database inserts, but the code you posted has to do with serialization so I'm not sure quite what you are asking.

Based solely on the code you have a above, my guess is that the value of "vector" isn't what you think it is prior to serialization. There's nothing notable about the code you posted.

-steve
Brain.Save() -- http://hyperthink.net/blog
Steve Maine
Hi Priya -- I'm a little confused by your question. You talk a lot about wanting to do database inserts, but the code you posted has to do with serialization so I'm not sure quite what you are asking.

Based solely on the code you have a above, my guess is that the value of "vector" isn't what you think it is prior to serialization. There's nothing notable about the code you posted.

-steve
Brain.Save() -- http://hyperthink.net/blog
Steve Maine

You can use google to search for other answers

Custom Search

More Threads

• .remoting singelton and multi-threading
• How to Serialize a non Sertilizable object into Binary?
• Make object local and remote
• impersonating the user initiating an action over the network
• Underlying socket was closed
• Error Serializing a class with System.Uri as a method parameter
• Client disconnects from server, or...
• My proxy call disappears
• How to use data available on Internet or some site in our application..
• Is it possible to deserialize an object to a modified class?