The new row added didn’t save into underlying database using C# and SQL server -
i trying code add new row database, new row saved when close program down, reopen it, row has disappeared.
private void dep_add_click(object sender, eventargs e) { try { sqlcommandbuilder cb = new sqlcommandbuilder(dep_da); datarow drow = dep_ds.tables["department"].newrow(); drow[1] = dep_name.text; dep_ds.tables["department"].rows.add(drow); dep_maxrows = dep_maxrows + 1; dep_inc = dep_maxrows - 1; dep_da.update(dep_ds,"department"); } catch (exception exceptionobject) { messagebox.show(exceptionobject.message); }
so hope can me
you don't give context information, bit of guess...
if doing inside visual studio, , writing local (attached) database, every time execute program, local db being copied project bin folder, starting each execution same copy of database, overwriting db modified in last execution.
you should able test if case running exe explorer or command line.
Comments
Post a Comment