Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Private Sub ButtonDelete_Click(sender As Object, e As EventArgs) Handles ButtonDelete.Click
- Dim MetuRow As DataGridViewRow
- Dim ID As String
- For Each MetuRow In DataGridViewContact.SelectedRows
- ID = MetuRow.Cells(0).Value
- Next
- Console.WriteLine("Deleting ID " + ID)
- Try
- Conn = New SqlCeConnection
- Cmd = New SqlCeCommand
- Conn.ConnectionString = MyConString
- Cmd.Connection = Conn
- Cmd.CommandText = "DELETE FROM TableContact WHERE(ID = " + ID + ")"
- Conn.Open()
- Cmd.ExecuteNonQuery()
- Conn.Close()
- MessageBox.Show("ID " + ID + " deleted")
- LoadData()
- Catch ex As Exception
- MessageBox.Show(ex.ToString)
- End Try
- End Sub
Advertisement
Add Comment
Please, Sign In to add comment