I have a code to delete a record from DataTable. First I delete the record using
cmSchool.RemoveAt(cmSchool.Position), and the record is deleted from the DataTable. Then I delete the record from the underlying database using m_daSchool.Update(m_dsSchool, "School")
Since the record is referenced by children table, so it cannot be deleted.
But the record already disappeared from the DataTable.
Could you please tell me how i can rollback this record to the DataTable?
Public Class frmUtilities
Private cmSchool As CurrencyManager
Private m_dwSchool As DataView
Private Sub frmUtilities_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'//-- bound to controls
m_dwSchool.Sort = "SCH_NAME"
txtSchool.DataBindings.Add("text", m_dwSchool, "sch_name")
txtSchoolNo.DataBindings.Add("text", m_dwSchool, "sch_id")
cmSchool = Me.BindingContext(m_dwSchool)
Private Sub btnDelete_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Dim Result As DialogResult
Result = MessageBox.Show(Me, "Do you want to delete the record", "Delete Record", MessageBoxButtons.YesNo, _
MessageBoxIcon.Question, MessageBoxDefaultButton.Button1, MessageBoxOptions.RightAlign)
If Result = DialogResult.No Then Exit Sub
If (cmSchool.Count > 0) Then
Catch ex As Exception