good day is there a way in storing image and retrieving images using ms access and display in picture box randomly or just like a slideshow?which slides form left to right?or vice versa..i have some codes here but i does not display...hope you could help me and correct me..thanks more power daniweb.
str = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Program Files\chuloader\Chu'sLoadCompute\Chu'sLoadCompute\bin\Release\Imagebank.accdb;User Id=admin;Password=;"
con = New OleDbConnection(str)
sql = "select image_name from picture order by id"
cmd = New OleDbCommand(sql, con)
con.Open()
dr = cmd.ExecuteReader(CommandBehavior.CloseConnection)
'Dim c = ds.Tables("Picture").Rows.Count
'Dim c As Byte() = CType(dr.Item("image_name"), Byte())
If dr.Read Then
Dim flote(dr.GetBytes(1, 0, Nothing, 0, Integer.MaxValue) - 1) As Byte
dr.GetBytes(1, 0, flote, 0, flote.Length)
Dim stmBLOBData As New MemoryStream(flote)
picture_box.Image = Image.FromStream(stmBLOBData)
End If
dr.Close()
'If c > 0 Then
'Dim flote As Byte() = ds.Tables("Picture").Rows(c - 1)("image_name")
'Dim stream As New MemoryStream(flote)
'picture_box.Image = Image.FromStream(stream)
'stream.Close()
'End If
con.Close()
Catch ex As OleDbException
MsgBox(ex.Message, MsgBoxStyle.Critical, "oledb Error")
Catch ex As Exception
MsgBox(ex.Message, MsgBoxStyle.Critical, "General Error")
End Try