If Me.DataGridView5.Rows.Count > 0 Then If Me.DataGridView5.SelectedRows.Count > 0 Then Dim intStdID As String = Me.DataGridView5.SelectedRows(0).Cells(0).Value 'open connection If DataGridView5.Rows.Count = 0 AndAlso DataGridView5.SelectedCells.Count = 0 Then MsgBox("Please select an Account to disable", MsgBoxStyle.Exclamation) Exit Sub End If If Not cnn.State = ConnectionState.Open Then cnn.Open() End If 'delete data Dim cmd As New OleDb.OleDbCommand cmd.Connection = cnn cmd.CommandText = "DELETE FROM AccAdmin WHERE Username=" & intStdID cmd.ExecuteNonQuery() 'refresh data Me.RefreshData() 'close connection cnn.Close() End If End If
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)