bommelding
New member
- Joined
- Jan 22, 2006
- Messages
- 1
I am trying to retrieve a picture that is stored in an access db with the following code:
At myreader.getbytes I get an error, does anyone know what I should do to make it work?
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?