• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 357
  • Last Modified:

Getting BLOB data field from database into a standard textbox

I have two types of BLOB in my database, image and text. I can save and retrieve images fine. I can store text in my database but have no idea how to get it into a textbox.

I can get a BLOB object from my MS Access 2000 database into a picturebox, how do i get it into a textbox? I have this code for the picturebox

'if its an image then do this      
     Dim ByteArray() As Byte
     'assign BLOB from db to bytearray
     ByteArray = DirectCast((myDataTable.Rows(0)(0)), Byte())
     'assign bytearray to memorystream
     Dim memstrm As New MemoryStream(ByteArray)
     'assign memorystream to picturebox
     PictureBox1.Image = Image.FromStream(memstrm)
'if its text then do this
                'textbox1.Text = ????

any help much appreciated
0
ab2ae
Asked:
ab2ae
2 Solutions
 
bchoorCommented:
maybe something like this
System.Text.Encoding.Default.GetChars(ByteArray)
0
 
Bob LearnedCommented:
Actually, System.Text.Encoding.UTF8.GetString(byteArray) would probably do the job more efficiently.

Bob
0
 
ab2aeAuthor Commented:
excellent work experts, thanks!!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now