DatakeyField with multi-column primary key

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,228
Members
46,817
Latest member
AdalbertoT

Latest Threads

Top