Private Sub cmdDel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdDel.Click If MessageBox.Show("Are you sure?", "Delete", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) = Windows.Forms.DialogResult.No Then MsgBox("Record Deletion Opearation Cancelled") Exit Sub End If Try ''STR = "DELETE FROM StdMasterNew WHERE '" & TextBox1.Text & "'=ID" ''STR = "DELETE FROM StdMasterNew WHERE ID='" & TextBox1.Text & "'" STR = "DELETE FROM StdMasterNew WHERE ID= " & TextBox1.Text & "" CMD = New OleDbCommand(STR, CON) CON.Open() CMD.ExecuteNonQuery() CON.Close() Me.Refresh() MsgBox("Existing Record Updated Successfully...") Catch If CON.State = ConnectionState.Open Then CON.Close() End If MessageBox.Show("Error Deleting data...") 'MsgBox(ex.Message & " - " & ex.Source) 'MessageBox.Show(ex.Message) End Try CON.Open() STR = "SELECT * FROM StdMasterNew" CMD = New OleDbCommand(STR, CON) CMD.ExecuteNonQuery() CON.Close() 'Moving to Last Record CurrentRow = DST.Tables("ClassMan").Rows.Count - 1 ShowData(CurrentRow) End Sub
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)