Hello,
How do i get this code to display my image using a database this is my code.
code Code:
Private Sub Details() Dim oleDBC As New OleDbCommand Dim OLEDBDR As OleDbDataReader con.Open() With oleDBC .Connection = con .CommandText = "SELECT UserID,imagepath FROM Users" End With OLEDBDR = oleDBC.ExecuteReader If OLEDBDR.HasRows Then While OLEDBDR.Read lblName.Text = (OLEDBDR.Item(0)) PictureBox1.Image = (OLEDBDR.Item(1)) End While con.Close() End If End Sub
I get an error saying
Unable to cast object of type 'System.String' to type 'System.Drawing.Image'.
but if i use lblName.Text = (OLEDBDR.Item(1)) it will display the path to the image.?




Reply With Quote