Click here to Skip to main content
15,881,248 members
Home / Discussions / C#
   

C#

 
AnswerRe: connection of database in C# Pin
Colin Angus Mackay8-Jul-09 2:10
Colin Angus Mackay8-Jul-09 2:10 
QuestionSort a group in crystal report Pin
Mohammad Al Hoss8-Jul-09 1:25
Mohammad Al Hoss8-Jul-09 1:25 
QuestionGPRS connectivity software Pin
Sufian Mehmood Sheikh8-Jul-09 1:10
Sufian Mehmood Sheikh8-Jul-09 1:10 
AnswerRe: GPRS connectivity software Pin
stancrm8-Jul-09 1:13
stancrm8-Jul-09 1:13 
GeneralRe: GPRS connectivity software Pin
Sufian Mehmood Sheikh8-Jul-09 1:52
Sufian Mehmood Sheikh8-Jul-09 1:52 
GeneralRe: GPRS connectivity software Pin
stancrm8-Jul-09 2:13
stancrm8-Jul-09 2:13 
QuestionHow can use RAPI? Pin
Le@rner8-Jul-09 1:06
Le@rner8-Jul-09 1:06 
QuestionSerializing/Deserializing an object Pin
Helfdane7-Jul-09 23:35
Helfdane7-Jul-09 23:35 
...and I fail at it Sigh | :sigh: And somehow I can't get a working answer on Google.

I want to store an in-memory generated assembly in the database for future use. I create this assembly from generated C#. For some reason, I can serialize the object, it generates a nice byte[] which is stored in the db. But when I want to retrieve the assembly for deserialisation to my object, I get an error like
"{"Unable to find assembly '9-onzk69, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'."}"

My serialization routine is:
public byte[] Formula2ByteArray(Compiler.CompiledFormula formula)
{	
byte[] result = null;

try
{
	System.IO.MemoryStream mStream = new System.IO.MemoryStream();
	System.Runtime.Serialization.Formatters.Binary.BinaryFormatter formatter =
		new System.Runtime.Serialization.Formatters.Binary.BinaryFormatter();

	formatter.Serialize(mStream, formula);

	result = mStream.ToArray();
}
catch (System.Exception ex)
{
	throw ex;
}

return result;
}


And my deserialisation code is:
public CompiledFormula LoadFormulaFromAssembly(byte[] array)
{
try
{
	Compiler.CompiledFormula formula;

	using (System.IO.MemoryStream stream = new System.IO.MemoryStream(array))
	{
		System.Runtime.Serialization.Formatters.Binary.BinaryFormatter formatter =
			new System.Runtime.Serialization.Formatters.Binary.BinaryFormatter();

		formula = (CompiledFormula)formatter.Deserialize(stream);
	}

	return formula;
}
catch (System.Exception ex)
{
	throw ex;
}
}


Both the application which saves it into the db and the application which uses it contain the same libraries, so the objects-structures are known to both apps. De serialisation/deserialisation routines are in the same library/class working with the same object model.

What am I missing? If I do something stupid, just tell me Smile | :)

The consumer isn't a moron; she is your wife.

AnswerRe: Serializing/Deserializing an object Pin
Hariharan.T8-Jul-09 0:29
Hariharan.T8-Jul-09 0:29 
GeneralRe: Serializing/Deserializing an object Pin
Helfdane8-Jul-09 0:35
Helfdane8-Jul-09 0:35 
GeneralRe: Serializing/Deserializing an object Pin
Hariharan.T8-Jul-09 1:12
Hariharan.T8-Jul-09 1:12 
GeneralRe: Serializing/Deserializing an object Pin
Helfdane8-Jul-09 1:27
Helfdane8-Jul-09 1:27 
Questioncan any body tell me how i can fix this error Pin
wasimsharp7-Jul-09 23:07
wasimsharp7-Jul-09 23:07 
AnswerRe: can any body tell me how i can fix this error Pin
Manas Bhardwaj7-Jul-09 23:18
professionalManas Bhardwaj7-Jul-09 23:18 
QuestionCan anyone help me with displaying the correct value in Crystal Reports Pin
DotNetCoderJunior7-Jul-09 22:47
DotNetCoderJunior7-Jul-09 22:47 
QuestionInterop call fails with window scheduled task Pin
Hariharan.T7-Jul-09 22:44
Hariharan.T7-Jul-09 22:44 
AnswerRe: Interop call fails with window scheduled task Pin
Eddy Vluggen7-Jul-09 23:29
professionalEddy Vluggen7-Jul-09 23:29 
GeneralRe: Interop call fails with window scheduled task Pin
Hariharan.T8-Jul-09 0:23
Hariharan.T8-Jul-09 0:23 
Questionbyte array to image Pin
Vivek Vijayan7-Jul-09 21:19
Vivek Vijayan7-Jul-09 21:19 
AnswerRe: byte array to image Pin
SeMartens7-Jul-09 21:29
SeMartens7-Jul-09 21:29 
GeneralRe: byte array to image [modified] Pin
Vivek Vijayan8-Jul-09 0:16
Vivek Vijayan8-Jul-09 0:16 
GeneralRe: byte array to image Pin
SeMartens8-Jul-09 2:00
SeMartens8-Jul-09 2:00 
AnswerRe: byte array to image Pin
dan!sh 7-Jul-09 22:02
professional dan!sh 7-Jul-09 22:02 
GeneralRe: byte array to image Pin
Vivek Vijayan8-Jul-09 0:30
Vivek Vijayan8-Jul-09 0:30 
GeneralRe: byte array to image Pin
dan!sh 8-Jul-09 0:33
professional dan!sh 8-Jul-09 0:33 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.