Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.
Delete records for Two Tables
am trying to delete records from two tables at once. They are not using the same Primary key.
Does that make a difference ? STUDENTCODE and STUDENTNUMBER are the primary key
Would it help to set a relationship ?
How can a update my UserInterface after the Delete?
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
Dim cmd As New OleDbCommand("DELETE FROM [STUDENT] " & _
"WHERE [STUDENTCODE] = '" & MaskedTextBox1.Text & "'", con)
dt = New DataTable
Dim CMD2 As New OleDbCommand("DELETE FROM [TESTS] " & _
"WHERE [STUDENTNUMBER] = '" & MaskedTextBox2.Text & "'", con)
Me.BindingContext(stu.dt).EndCurrentEdit() ' Student table
Me.BindingContext(bk.dt).EndCurrentEdit() ' Tests table
0 · ·