Forum > Database

Multi Delete from a TRxDBGrid


Hi there,
I've got a TRxDBGrid(almost the same with DBGrid just has much more functions) connected to a datasource (which is connected to a tzquery.dataset). The TRxDBGrid Options allow me to have multi selection to rows(Options->dgMultiselect ->True). Can I have multi delete from this TRxDBGrid ? I have connected this TRxDBGrid  with a TDBnavigator and when I select more than one row and press the delete button(-) from navigator no multi delete happens.  It just deletes the first selected row. I don't want to use TDBnavigator  if possible. in order to delete only one row I use the following code:

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---   index := FindColumnIndex(TRxDBGrid1  , 'NUM');//FindColumnIndex finds the index of the column NUM from the  TRxDBGrid1    TRxDBGrid1.SelectedIndex := index;  deletednum:= TRxDBGrid1.Columns.Items[index].Field.Value;  if MessageDlg('Delete Number', 'Do you wish to Delete this NUM ?', mtConfirmation, [mbYes, mbNo], 0) = mrYes then  begin      DbModule.GeneralQuery.Close;      DbModule.GeneralQuery.Connection := DbModule.ZConnection1;      DbModule.GeneralQuery.SQL.Clear;      DbModule.GeneralQuery.SQL.Text := 'DELETE FROM TABLE WHERE NUM= ' + InttoStr(deletednum);      DbModule.GeneralQuery.ExecSQL;      TRxDBGrid1.DataSource.DataSet.Refresh;
Any help if possible :).
Thank you.


[0] Message Index

Go to full version