I don't think the CopyDataFrom will work because that either adds new rows, which I don't want, or replaces the entire DataTable, again, not what I'm looking for. I just want to update a couple of fields in the Parent current row.
No. You can definitely make the CopyDataFrom method work in this scenario. Delete the record out the the current BO without updating the server:
'-- Remove the existing record
MyBo.DeleteCurentRow(True)
MyBo.CurrentDataTable.AcceptChanges()
'-- Get the new record
Using bo As New MyBoType
bo.FillByPrimaryKey(changedPk)
'-- Copy the data back into the source BO
MyBo.CopyDataFrom(bo,AppendFromCurrentDataTable)
End Using
I solved this with a SqlCommand/SqlDataReader to fetch the fields for the current row then copying them from the reader back to Parent.currentRow. Changing Parent field values set the form to edit mode so when I close the window it asks to save/cancel. Is there a way to suppress changing edit states?
You can do that as well. You cannot supress the states from changing but you can call AcceptChanges to accept the state of the data as it is in the BO which will then make the BO think that data in the BO and on the server are the same.