Forum > Databases

DBGrid multiselect

<< < (2/2)

TRon:

--- Quote from: CharlyTango on May 19, 2024, 10:54:33 am ---Could you please post the link, so this thread is linked to the solution ?

--- End quote ---
The only related post from GAN that I was able to locate can be found in this thread

teresa:

--- Quote from: CharlyTango on May 19, 2024, 10:54:33 am ---Could you please post the link, so this thread is linked to the solution ?

--- End quote ---

Sure:

https://forum.lazarus.freepascal.org/index.php/topic,36900.msg246513.html#msg246513

egsuh:
I'm trying to extend this to delete multiple rows at once in following way. BeforeDelete event is to delete the record from SQL server before the record is deleted at the TDataSet.


--- 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";}};} ---procedure TSampleList.DBNavigator1Click(Sender: TObject;   Button: TDBNavButtonType);var   i: Integer;begin   if Button = nbDelete then begin      for i:=0 to dbgSampleList.SelectedRows.Count-1 do         with dbgSampleList.DataSource.DataSet do         begin            GotoBookmark(pointer(dbgSampleList.SelectedRows.Items[i]));            Delete;         end;   end;end; procedure TSampleList.bdsSampleListBeforeDelete(DataSet: TDataSet);var   tclause: string;begin   TClause := Format('project_id=''%s'' and respondent_id=%d',             [pid, bdsSampleList.FieldByName('RID').AsInteger]);   if not DataAccess.DeleteARecord('SampleList', tclause)      then bdsSampleList.Cancel;end; 
This deletes as I want, but it causes memory leak, as attached in the image. What might have caused this?

Navigation

[0] Message Index

[*] Previous page

Go to full version