Thursday, March 22, 2012

Simple Dataset Update Question

I have a grid working well. I must admit it uses all the RAD functions, so it is uses a dataset which has all its update commands generated. All well and good.

I open the dataset in two browser windows. I delete a row from one browser window, and all is good. I can obviously still see the record in the other browser window, so I press to delete it as a test and it falls over. Obviously it should fall over, but I'm wondering how to handle it.

When a user selects a record, or tries to delete a record that has already been deleted by another user I just want to make sure the system doesn't fall over, and the data is refreshed.

How do I go about doing this? I would like to keep using the dataset auto-generated update commands at this time - so I suspect I need to catch the error, do nothing to display the error, but refresh the data?Are u doing a DatGrid.DataBind() after in your delete button's code?? Also, in your query, first check if the datatable indeed contains the row that you are looking for, if u find it..just delete it, if not dont do anything and bind the datatable to datagrid.

hth
Yeah, as soon as I posted I thought of the answer - and shook my head in shame :)

I'm rebinding each time, the issue is what a user in a total different session sees, but all I'm doing is after finding the row to delete I check if the row variable is nothing, if it is I just rebind, etc. If the row object has a value I do the delete.

Obvious really :)

0 comments:

Post a Comment