• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 356
  • 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

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

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