sql server - RowState property not changing -
i have table edit won't save changes. looks problem rowstate not changing. foreach loop debugging:
private void btnsave_click(object sender, eventargs e) { this.validate(); bs.endedit(); dsedit.tables["broker"].getchanges(); datatable dtout = dsedit.tables["broker"]; foreach (datarow rout in dtout.rows) { console.writeline(rout.rowstate.tostring()); console.writeline(rout["contactfax"]); rout["contactfax"] = "change"; console.writeline(rout.rowstate.tostring()); console.writeline(rout["contactfax"]); } int n = sdabkr.update(dsedit.tables["broker"]); messagebox.show(n.tostring() + " record(s) saved."); }
the console output follow::
unchanged fax number here unchanged change
what can cause this? don't see unusual properties set in database.
answer found here: endedit on bindingsource updates datatable, rowstate still unchanged
calling endedit on each row as
rout.endedit();
fixes problem, don't understand, , don't see in documentation.
Comments
Post a Comment