retrieving image from database

后端 未结 1 360
感情败类
感情败类 2021-01-28 12:15

I\'m working on my project which displays a list of employee. here, the information and picture of the employee will be shown. my project can now show the list of employees in t

相关标签:
1条回答
  • 2021-01-28 13:04

    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.

    0 讨论(0)
提交回复
热议问题