vb.net - This error is misleading compared to the User Interface -


error:

update requires valid updatecommand when passed datarow collection modified rows.

now that's popular question managed find online. have answers, doesn't. here issue. did following tutorial in book microsoft press.. connect sql server database via windows authentication, pull 2 fields table form textboxes showed in screen shot. has add, delete, update buttons (automatically created).

enter image description here

then generates following code, , points error @ update line. tried do, update id = 2 id = 3. there no primary key in table trying out ado.net side compoents(connections/display , on).

private sub testdbtable1bindingnavigatorsaveitem_click                 (byval sender system.object, byval e system.eventargs) handles                                 testdbtable1bindingnavigatorsaveitem.click     me.validate()     me.testdbtable1bindingsource.endedit()     me.tableadaptermanager.updateall(me.testcmddbdataset) //-------<< error end sub 

so what's real reason of having save or update button in form? why can't save record change?

the tableadapter can not generate update logic when there no primary key on table. add pk, go designer dataset , regenerate queries. make sure insert , update queries have been generated time.


Comments

Popular posts from this blog

ruby - Trying to change last to "x"s to 23 -

jquery - Clone last and append item to closest class -

c - Unrecognised emulation mode: elf_i386 on MinGW32 -