Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
865
Schedule and owner error
posted

Hi

I am new to this contorl. i have two tables which one stores data for the schedule and the other stores the owner. When i run my application i get the following error message:

  1. There is already an owner with key ''5'.owner key must be unique.
  2. and then i get this error: Key already exist.parameter name:key

Could you tell me what is the problme please?

I checked the sample and noticed that there are duplicate key in the schedule table.

This is my code:

Private myDT As New DataTable("ServiceApp")

Private myDS As New DataSet

Private myDTOwner As New DataTable("ServiceOwner")

Private myDSOwner As New DataSet

Private Sub GetApponitmentSVC()

Me.CalendarInfoSVC.DataBindingsForAppointments.BindingContextControl = Me

Me.CalendarInfoSVC.DataBindingsForAppointments.SubjectMember = myDS.Tables.Item(0).Columns("JobNo").ColumnName

Me.CalendarInfoSVC.DataBindingsForAppointments.EndDateTimeMember = myDS.Tables.Item(0).Columns("CheckOutDate").ColumnName

Me.CalendarInfoSVC.DataBindingsForAppointments.StartDateTimeMember = myDS.Tables.Item(0).Columns("CheckInDate").ColumnName

Me.CalendarInfoSVC.DataBindingsForAppointments.OwnerKeyMember = myDS.Tables.Item(0).Columns("ServCatID").ColumnName

Me.CalendarInfoSVC.DataBindingsForAppointments.DescriptionMember = myDS.Tables.Item(0).Columns("Description").ColumnName

Me.CalendarInfoSVC.DataBindingsForAppointments.DataKeyMember = myDS.Tables.Item(0).Columns("ServiceHID").ColumnName

Me.CalendarInfoSVC.DataBindingsForAppointments.SetDataBinding(myDS, String.Empty)

End Sub

Private Sub GetAppointmentOwner()

Me.CalendarInfoSVC.DataBindingsForOwners.BindingContextControl = Me

Me.CalendarInfoSVC.DataBindingsForOwners.KeyMember = myDS.Tables.Item(1).Columns("ServCatID").ColumnName

Me.CalendarInfoSVC.DataBindingsForOwners.NameMember = myDS.Tables.Item(1).Columns("Description").ColumnName

Me.CalendarInfoSVC.DataBindingsForOwners.SetDataBinding(myDS, String.Empty)

End Sub

Private Sub ServiceFrm_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

myDT = MobService.ListServiceAppointments()

myDS.Tables.Add(myDT)

myDTOwner = MobService.ListServiceCategory(
False)

myDS.Tables.Add(myDTOwner)

GetApponitmentSVC()

GetAppointmentOwner()

End Sub

thanks for your help.

Kamal