DatakeyField with multi-column primary key

From: Beryl Small (berylsmall_at_computechsi.com)
Date: 03/01/04


Date: Sun, 29 Feb 2004 18:24:00 -0600

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



Relevant Pages

  • Re: Modules not Known
    ... Dim pCode$ ... Dim pCodeModule As CodeModule ... Private Sub VBIDEReference() ... Option Compare Database ...
    (comp.databases.ms-access)
  • A VB6 program to generate CONSTants for a user defined gradient
    ... EndProperty ... It may be used for amy moral purpose. ... Dim mGreen1 As Long ... Private Sub ColorDisplay_MouseDown(Button As Integer, Shift As Integer, _ ...
    (comp.lang.basic.visual.misc)
  • Re: access 2003
    ... Dim ctl As Control ... Dim rs As Recordset ... This sets the query definitions for choosing data to create an invoice using ... Event on combo box: Private Sub ChooseCust_AfterUpdate ...
    (microsoft.public.access.conversion)
  • Re: Gradient Generator BMP Tool Improved
    ... EndProperty ... It may be used for amy moral purpose. ... Dim mGreen1 As Long ... Private Sub ColorDisplay_MouseDown(Button As Integer, Shift As Integer, _ ...
    (comp.lang.basic.visual.misc)
  • Multiple Calendar Control on one page
    ... Protected WithEvents Calendar1 As System.Web.UI.WebControls.Calendar ... Private Sub Page_Init(ByVal sender As System.Object, ... Dim mo As String ...
    (microsoft.public.inetserver.asp.components)