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

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,901
Latest member
Noble71S45

Latest Threads

Top