Information générale
Catégorie:
The Mere Mortals .NET Framework
Titre:
Cannot Add a New Row
Versions des environnements
"Concurrency Violation: the UpdateCommand affected 0 records."
The table I'm working with has a column that references itself.
The table contains Staff members. Each staff member is assigned
a supervisor, which must exist in the staff table.
The staff bizobj is registered twice:
// driving table for form
this.oStaff = (STAFF_BO)this.RegisterPrimaryBizObj(new STAFF_BO());
// supervisor dropdownlist source
this.oStaffSuper = (STAFF_BO)this.RegisterBizObj(new STAFF_BO());
Datasets are created in the form's constructor:
// tablename="STAFF"
mmDataSet dsStaff = (mmDataSet)oStaff.GetRecordByPK
(this.CurrentPrimaryKey);
// for Supervisor dropdown list; tablename="Supervisors"
oStaffSuper.GetStaffIDName_WithBlank("Supervisors");
// Set current data set to get entered information into the new row.
// If this command is not executed, the entered data does not get into
// the new row.
// When this command executes, the dataset's Row.RowState changes from
// "Added" to "Modified", causing the concurrency error.
((STAFF_BO)this.GetBizObj("STAFF_BO")).SetCurrentDataSet(dsStaff);
The combobox binding properties:
BindingSource=STAFF_BO
BindingSourceDisplayMember=Supervisors.fullname
BindingSourceValueMember=Supervisors.staffPK
BindingValueSource=STAFF_BO
BindingValueSourceMember=staffFK
Any and all suggestions on how to fix this error are gladly accepted.
TIA -
Patty
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement