Ramana

Ramana

  • NA
  • 25
  • 45.9k

Out of Memory exception while converting byte array into string

May 9 2011 3:21 AM
Hi,
  I'm getting out of memory exception while converting byte array into a string. Initially I've stored content of a file(338 MB) into DataBase in varbinay format , after reading the content from DataBase I'm conveting that Byte array into string wher I'm getting the error .

  var val = cmd.ExecuteScalar();//Getting form DataBase
  System.Text.Encoding enc = System.Text.Encoding.ASCII;
  string myString = enc.GetString((byte[])val);//Converting into String

Please someone tell me a solution.

Thanks & Regards,
Ramana

Answers (2)