how to display an image from database access??

Submitted by: 

this is my coding for the search button where actually i want all the details for the searched staff will be display

  1. Try
  4. sql = "SELECT * FROM Staff WHERE staff_ic = '" & sticnumbertxt2.Text & "'"
  5. con.Open()
  6. Dim cmd As OleDbCommand
  7. Dim dr As OleDbDataReader
  9. cmd = New OleDbCommand(sql, con)
  10. dr = cmd.ExecuteReader
  12. While dr.Read()
  13. stnametxt2.Text = dr("staff_name")
  14. staddresstxt2.Text = dr("staff_address")
  15. stpostcodetxt2.Text = dr("staff_postcode")
  16. ststatetxt2.Text = dr("staff_state")
  17. stcontacttxt2.Text = dr("staff_contact")
  18. stphonetxt2.Text = dr("staff_phone")
  19. staffid.Text = dr("staff_id")
  20. staffPictureBox2.Image = dr("staff_image")
  21. End While
  22. Catch ex As Exception
  23. MessageBox.Show(ex.Message)
  24. End Try
  25. con.Close()
Image icon untitled-34.jpg30.67 KB

In which format you are saving image in access? A snapshot query saving image wold be beneficial!


Add new comment

Filtered HTML

  • Web page addresses and e-mail addresses turn into links automatically.
  • You may insert videos with [video:URL]
  • Allowed HTML tags: <a> <em> <strong> <cite> <blockquote> <code> <ul> <ol> <li> <dl> <dt> <dd> <table> <tr> <td> <th> <img> <h1> <h2> <h3> <iframe> [video]
  • You can enable syntax highlighting of source code with the following tags: <code>, <blockcode>, <asp>, <c>, <cpp>, <csharp>, <css>, <html4strict>, <java>, <javascript>, <mysql>, <php>, <python>, <sql>, <vb>, <vbnet>. The supported tag styles are: <foo>, [foo].
  • Lines and paragraphs break automatically.

Plain text

  • No HTML tags allowed.
  • Lines and paragraphs break automatically.
This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.