datagrid editing

  • Thread starter Thread starter Mike P
  • Start date Start date
M

Mike P

I have a datagrid with a 'Delete' column that the user can click on to
delete a row in the datagrid. I thought that I would need to have some
kind of error handling in case somebody goes into the database table
that the datagrid uses and deletes a record while the user is still
viewing the record in their datagrid, since if they then press 'Delete'
on a record that has since been deleted from the table, a concurrency
error should occur. But after trying this, no error is raised at all,
on pressing 'Delete' the record is simply removed from the datagrid.
Does anybody know why this happens? And do I therefore not need to
provide error handling for this?


Cheers,

Mike
 
most likely you have removed the record from the datagrid or the underlaying
dataset and then not bound back to the database table.

you need to delete from the database table and the rebind the datagrid.

if you are deleting from the database using a command such as

"Delete from mytable where record=deletevalue"

and this record does not exist in the db then you will not get an error. It
is best to check the rowcount property (usually in the db) to actually
ensure that 1 row was deleted.
although you may think not deleting a row is an error, the database does
not.

hope I have understood you correctly.

cheers

martin
 
Martin,

I just wondered if I should be getting an error even though I wasn't.
I'm using direct SQL 'DELETE * FROM Table WHERE ID = ", so if this isn't
actually meant to generate an error, it is probably OK to leave my code
as it is...there's no need to inform the user that the record was
deleted by somebody else, as long as it is deleted.


Thanks,

Mike
 
Back
Top