Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

I am trying to retrieve a picture that is stored in an access db with the following code:

 

 MyConnection.Open()
       Dim MyCommand As New OleDbCommand("SELECT * FROM tblwater WHERE waterid=" & wateren.waterid, MyConnection)
       MyReader = MyCommand.ExecuteReader()
       MyReader.Read()
       txtnaam.Text = MyReader("water_naam")
       txtplaats.Text = MyReader("water_plaats")
       txttype.Text = MyReader("water_soort")
       txtomschrijving.Text = MyReader("water_omschrijving")
       txtopp.Text = MyReader("water_opp")
       'foto ophalen

       Dim bytBLOBData(MyReader.GetBytes(1, 7, Nothing, 0, Integer.MaxValue) - 1) As Byte
       MyReader.GetBytes(1, 0, bytBLOBData, 0, bytBLOBData.Length)
       Dim stmBLOBData As New MemoryStream(bytBLOBData)
       waterfoto.Image = Image.FromStream(stmBLOBData)
       
       MyConnection.Close()

 

At myreader.getbytes I get an error, does anyone know what I should do to make it work?

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...