Перефразировать инструмент бесплатно онлайн
Private Sub DeleteButton_Click(sender As Object, e As EventArgs) Handles DeleteButton.Click
Try
connection.Open()
Using command As New SqlCommand("DELETE FROM students WHERE STUDENT_NUMBER = @NUM", connection)
command.Parameters.Add("@NUM", SqlDbType.VarChar).Value = txtRegNumber.Text
command.ExecuteNonQuery()
MessageBox.Show("DATA WAS DELETED sUCCESSFULLY")
End Using
connection.Close()
Catch ex As Exception
MessageBox.Show(ex.Message, "An Error Occurred", MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try
End Sub
Nutty Narwhal