B
Beryl Small
Have a datalist bound to a dataset. When I run the following code it
deletes the selected record from the screen but not from the underlying
table. The dataset is made up of three joined tables, the primary key on
the main table is made up of two fields (ClassID and StudentID) can anyone
tell me why my code does not work?
Private Sub dlSchedule_ItemCommand(ByVal source As Object, ByVal e As
System.Web.UI.WebControls.DataListCommandEventArgs) Handles
dlSchedule.ItemCommand
If e.CommandName = "DeleteClass" Then
Dim myDv As DataView
Dim intClientID As Integer
intClientID = Session("Client")
Dim StudentSchedule As GNOIEC.GNOIECWEB = New GNOIEC.GNOIECWEB
MyResults = StudentSchedule.GetCurrentRegistrations(intClientID)
MyResults.Tables(0).DefaultView.Delete(e.Item.ItemIndex())
MyResults.Tables(0).AcceptChanges()
dlSchedule.DataSource = MyResults
DataBind()
End If
End Sub
deletes the selected record from the screen but not from the underlying
table. The dataset is made up of three joined tables, the primary key on
the main table is made up of two fields (ClassID and StudentID) can anyone
tell me why my code does not work?
Private Sub dlSchedule_ItemCommand(ByVal source As Object, ByVal e As
System.Web.UI.WebControls.DataListCommandEventArgs) Handles
dlSchedule.ItemCommand
If e.CommandName = "DeleteClass" Then
Dim myDv As DataView
Dim intClientID As Integer
intClientID = Session("Client")
Dim StudentSchedule As GNOIEC.GNOIECWEB = New GNOIEC.GNOIECWEB
MyResults = StudentSchedule.GetCurrentRegistrations(intClientID)
MyResults.Tables(0).DefaultView.Delete(e.Item.ItemIndex())
MyResults.Tables(0).AcceptChanges()
dlSchedule.DataSource = MyResults
DataBind()
End If
End Sub