Jump to content


How to delete selected rows from database?


  • Please log in to reply
No replies to this topic

#1 tarnschaf

tarnschaf
  • Members
  • 12 posts

Posted 27 February 2012 - 12:29 AM

Hi Boki,

I have another question regarding MultiSelect.

My grid allows to select rows and then perform different actions on them. As I already stated in another thread I am using


	  for I := 0 to gridResults.RowCount - 1 do
	  begin
		if gridResults.Selected[I] then
		begin
		  myDataSet.Bookmark := gridResults.CellField[0, I].Origin;
		  DoTheSelectedAction;
		end;
	  end;

to accomplish this.

Now there is another action that should delete the selected rows. This doesn't work because the first call to dataset.Delete() will change the data and update NextGrid. I tried to use dataSet.DisableControls before and EnableControls after my for-loop. This changes the behaviour but still doesn't work.

In another thread you mentioned using a while-loop instead of the for-loop. I tried a while-loop that does NOT increment it's loop-variable if something has been deleted. But this doesn't work either.

1. Can you point me to an example of how to accomplish this?

2. Is the ....Bookmark := ....Origin the right way to move the dataset?

Thanks,
Michael




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users