2
Answers

Out of Memory exception while converting byte array into string

Ramana

Ramana

13y
3.7k
1
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)