Dbgrid row count lazarus / 16-Databases ---------------------------------------------------------------------- mpknap · 2020-01-31 08:50 I can't find on the internet how to count how many rows have dbgrid1 (or sql records loaded into dbgrid)? later there will be information in label1.caption ---------------------------------------------------------------------- lucamar · 2020-01-31 10:07 Try with DBGrid.DataSource.DataSet.RecordCount, but, as the docs say, remember that: QuoteRecordCount is the number of records in the dataset. This number is not necessarily equal to the number of records returned by a query. For optimization purposes, a TDataset descendent may choose not to fetch all records from the database when the dataset is opened. If this is the case, then the RecordCount will only reflect the number of records that have actually been fetched at the current time, and therefor the value will change as more records are fetched from the database. Only when Last has been called (and the dataset has been forced to fetch all records returned by the database), will the value of RecordCount be equal to the number of records returned by the query. ---------------------------------------------------------------------- mpknap · 2020-02-01 08:33 yes label1.Caption:=DataSource1.DataSet.RecordCount.ToString; displays the number of records on the screen in dbgrid. Just using DBNavigator click manualy on "Last" button and then in label1 it will show how many are all. And how to programatically press "Last" button in DBNavigator? ---------------------------------------------------------------------- HeavyUser · 2020-02-01 09:48 Quote from: mpknap on February 01, 2020, 09:33:47 amyes label1.Caption:=DataSource1.DataSet.RecordCount.ToString; displays the number of records on the screen in dbgrid. Just using DBNavigator click manualy on "Last" button and then in label1 it will show how many are all. And how to programatically press "Last" button in DBNavigator? Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i DataSource1.DataSet.Last; ---------------------------------------------------------------------- mpknap · 2020-02-01 17:03 Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i   datasource1.DataSet.Last;    datasource1.DataSet.First;    label11.Caption := 'Rec ' + DataSource1.DataSet.RecNo.ToString + '  of ' +      DataSource1.DataSet.RecordCount.ToString;    thx