Error while deleting a row in a bound datagridview


i trying delete row , update database, wrote code, results in error:

dynamic sql generation updatecommand not supported against selectcommand not return , key column information.

the sql table contains primary key, idea ?

        grdaccounttypes.rows.remove(grdaccounttypes.currentrow)
        dataadapter.update(ctype(me.bindingsource1.datasource, datatable))
        bindingsource1.datasource.accounttypse.acceptchanges()
        messagebox.show("update successful")

 

and yes there primiary key, no didn't set in adapter

hi,

the error message indicates primary key of sql server table not returned. must provide primary key information update or delete records. please refer following links: 

using commandbuilder create dynamic command objects
http://bloggingabout.net/blogs/jschreuder/archive/2005/03/29/using-commandbuilder-to-create-dynamic-command-objects.aspx

weaning developers commandbuilder
http://msdn.microsoft.com/en-us/library/ms971491.aspx

a similar thread: http://social.msdn.microsoft.com/forums/en-us/adodotnetdataset/thread/b5f50346-cc37-499b-bfb9-009b68dcb362

if these links not you, please post complete code snippet , table ddl.


please remember mark replies answers if , unmark them if provide no help.
welcome all-in-one code framework! if have feedback, please tell us.


SQL Server  >  SQL Server Data Access



Comments

Popular posts from this blog

Motherboard replacement

Remote Desktop App - Error 0x207 or 0x607

AD Replication Failure Between Server 2008 R2 and Server 2003 - LDAP bind failed with error 8341