retrieving image from database

隐身守侯 提交于 2019-12-02 07:58:42

You miss the where clause is must be like to search a one employee to view there image.

adptr = _
      New MySqlDataAdapter("select picture from Employees " + _
      "where employee_id = " & lstEmployee.SelectedIndex, myConn)
cmd = New MySqlCommandBuilder
adptr.Fill(dt)
Dim lb() As Byte = dt.Rows(0).Item("picture")
Dim lstr As New System.IO.MemoryStream(lb)
pix.Image = Image.FromStream(lstr)
pix.SizeMode = PictureBoxSizeMode.StretchImage
lstr.Close()

P.S.: You must study the LINQ (Language-Integrated Query) for better approach.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!