I am having my data saved in my database as Longblob and while saving i am converting it to bytes and saving now while retrieving we can have that data by writing as follows
Byte[] bytes = (Byte[])dt.Rows[0]["Data"];
Response.BinaryWrite(bytes);
But what i need is i need that data in bytes to be represented as string is it possible
Well, is the data an encoded string? If so, use something like
… but make sure you use the right encoding.
If it’s arbitrary binary data though, you should use base64 instead:
That will get you an entirely-ASCII string which can be converted back to the original byte array using
Convert.FromBase64String.Without knowing what your data is, it’s impossible to say which of these approaches is appropriate. You say you’re converting your data to bytes when you save – but you haven’t said how you’ve converted your data to bytes. Basically you want to reverse that process, whatever it is.