delete error

cjaymcmeans

Well-known member
Joined
Jan 12, 2005
Messages
85
Programming Experience
3-5
im trying to delete multiple rows in a data row with one sql statement..
it works just fine it deletes in the data tables and Db.. .

problem is i always get a concurrency exeption whenever i run the delete...
although it performs the procedure just fine...

can you guys help me out...

Public Sub DelModAll(ByVal CCode As String, ByVal DelTable As DataTable)
Dim DelPrm As OleDbParameter
Dim DelCom As New OleDbCommand("Delete from tblmodule where
applicationcode=@CUId", ITRCon)
DelCom.CreateParameter()
DelPrm = DelCom.Parameters.Add("@CUId", CCode)
ModAdapter.DeleteCommand = DelCom
Try
ModAdapter.Update(DelTable)
Catch ex As Exception
MsgBox(ex.ToString)
End Try
End Sub

Public Sub DelApp(ByVal CCode As String, ByVal DelTable As DataTable)
Dim DelPrm As OleDbParameter
Dim DelCom As New OleDbCommand("Delete from tblapplication where applicationcode=@CUId", ITRCon)
DelCom.CreateParameter()
DelPrm = DelCom.Parameters.Add("@CUId", CCode)
AppAdapter.DeleteCommand = DelCom
Try
AppAdapter.Update(DelTable)
Catch ex As Exception
MsgBox(ex.ToString)
End Try
End Sub


Private Sub DeleteApp()
Dim DelRow As DataRow
Dim Delmod, Delmods() As DataRow
If Trim(txtAppCode.Text) <> "" Then
DelRow = ApplicationTable.Select("applicationcode='" & Trim(txtAppCode.Text) & "'")(0)
Delmods = ModulesTable.Select("applicationcode='" & Trim(txtAppCode.Text)
& "'")
If Not (DelRow.IsNull("applicationcode")) Then
DelRow.BeginEdit()
DelRow.Delete()
DelRow.EndEdit()
TempSystemObj.DelApp(Trim(txtAppCode.Text), ApplicationTable)
ApplicationTable.AcceptChanges()
For Each Delmod In Delmods
Delmod.BeginEdit()
Delmod.Delete()
Delmod.EndEdit()
Next
TempSystemObj.DelModAll(txtAppCode.Text, ModulesTable)
ModulesTable.AcceptChanges()
LvwModules.Items.Clear()
ClearMod()
lvwApplications.FocusedItem.Remove()
ClearApp()
End If
End If
End Sub

tnx..
 
Back
Top