General information
Category:
The Mere Mortals .NET Framework
Title:
Cannot Add a New Row
"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
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only