Saturday, March 31, 2007

Retrieving a large text stored as binary in the database.

- SQLHelper.ExecuteScalar would return an object.
- System.Runtime.Serialization.Formatters.Binary.BinaryFormatter bf_1 = new System.Runtime.Serialization.Formatters.Binary.BinaryFormatter();
MemoryStream mr_1 = new MemoryStream(objClassCode as Byte[]);
//retrieve the code from the database and assign to the variable.
string strText = bf_1.Deserialize(mr_1).ToString();
mr_1.Close();

No comments: