I have a table's column "Pictures" and I set its DataType as IMAGE.
But error occurs "No mapping exist from object type System.Windows.Forms.PictureBox to a known managed provider native type". How do I fix this problem? Thanks
What I have tried:
Private Sub btnAdd_Click(sender As Object, e As EventArgs) Handles btnAdd.Click
Dim cmd As New SqlCommand
Try
conn.ConnectionString = strcon
conn.Open()
cmd.Connection = conn
cmd.CommandText = "INSERT INTO PatientInfo (Surname,Firstname,MI,Gender,Birthday,Address,Contact,Email, Picture) VALUES(@Surname,@Firstname,@MI,@Gender,@Birthday,@Address,@Contact,@Email,@Photo)"
cmd.Parameters.AddWithValue("@Surname", txtSurname.Text)
cmd.Parameters.AddWithValue("@Firstname", txtFirstname.Text)
cmd.Parameters.AddWithValue("@MI", txtMI.Text)
cmd.Parameters.AddWithValue("@Gender", CmbxGender.Text)
cmd.Parameters.AddWithValue("@Birthday", dtpBday.Text)
cmd.Parameters.AddWithValue("@Address", txtAdd.Text)
cmd.Parameters.AddWithValue("@Contact", txtContact.Text)
cmd.Parameters.AddWithValue("@Email", txtEmail.Text)
cmd.Parameters.AddWithValue("@Photo", picbx2x2)
cmd.ExecuteNonQuery()
MessageBox.Show("Successful Added Data")
loadData()
conn.Dispose()
conn.Close()
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
End Sub