Okay, yet another newbie question regarding updating

  • Thread starter Thread starter Brad Allison
  • Start date Start date
B

Brad Allison

Sorry about this question as it is probably very basic...

I have the following snippet of code:

drEventCN.Item("EventID") = ThisEventID
drEventCN.Item("Breed") = cmbBreedCode.Text
drEventCN.Item("BreedJudge") = cmbJudgeID.Text
drEventCN.Item("CNRing") = cmbRing.Text
drEventCN.Item("CNOrder") = cmbRingOrder.Text
DsEventCN1.Tables("EventCN").Rows.Add(drEventCN)
Me.BindingContext(DsEventCN1, "EventCN").Position =
Me.BindingContext(DsEventCN1, "EventCN").Count - 1
daCNSetup.Update(DsEventCN1, "EventCN")
daCNSetup.Fill(DsEventCN1)

Adding and saving the first row works just find. When I use the ADD routine
(which resets all the fields on the form and uses the following:
drEventCN = DsEventCN1.Tables("EventCN").NewRow() ) and after updating the
fields for the next row, when the above runs again, I get a Procedural Call
error. When I trap the error, it is err.number 5.

Why can't I save multiple records to this table? I have scrutinized the
fields, their constraints and all seems fine.

Thanks for any help.
Brad
 
If you are using DataBinding, you probably do not need to call NewRow.
Simply call AddNew on the BindingContext. Not sure if that is the problem,
but it may help.
 
Back
Top