hey all,
im sort of new on .net and i was hoping if u can help me again. i am to search a a student record on sql server 2005 database. my problem is, i can search for records but i failed to display their pictures in the picturebox.
here is my code for searching:
str = "select * from studinfo_t where Studno like ('" & Trim(txtSearch.Text) & "%')"
Try
con.Open()
Dim com1 As New SqlClient.SqlCommand(str, con)
Dim dr As SqlClient.SqlDataReader = com1.ExecuteReader
While dr.Read
txtStudNum.Text = "" & (dr.GetValue(0))
txtLName.Text = "" & (dr.GetValue(1))
txtFirst.Text = "" & (dr.GetValue(2))
txtMI.Text = "" & (dr.GetValue(3))
txtGender.Text = "" & (dr.GetValue(4))
dpBirthday.Text = "" & (dr.GetValue(5))
txtAddress.Text = "" & (dr.GetValue(6))
cbCourse.Text = "" & (dr.GetValue(7))
txtSection.Text = ""(dr.GetValue(8))
picStudImg.Image = Image.FromStream(New MemoryStream(CType(dr.GetValue(9), Byte())))
End While
If Not dr.HasRows Then
MsgBox("No records found. Please try again.", MessageBoxIcon.Error, "No records found")
txtSearch.Clear()
End If
con.Close()
Catch ex As Exception
con.Close()
End Try
i was able to display all except for the image. i dont have any error on this code so i dont know what went wrong and why is it that the pic is not showing.. thanks in advance