c# - record delete error in database mdf in visual studio -


i have records having same id. trying delete them getting error:

no rows deleted

a problem occurred attempting delete row 9
error source microsoft visual studio.datatools
error message row values updated or deleted no make unique or alter multiple rows

may have not included primary key , there may duplicate records. try adding primary key table.

i have got explanation here

in sql server, there must way uniquely identify row delete or update action. if row(s) attempting delete duplicate other rows, not allowed delete them.

you options create either identity field in table, or primary key -both of uniquely identify row -allowing deletes occur.

update:

you create new column, , set column identity.

alter table_names
add id_new int identity(1, 1)
go

when change table, existing rows assigned unique value column, , able use new value in delete action.


Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -