Another DBGrid question lazarus / 31-LCL ---------------------------------------------------------------------- greertr · 2017-01-03 10:54 What's the max size of a dbgrid? I have a db with tables exceeding 40 and 50,000 records of aviation data for world airports.. When I run zeos db and sqlite3, only about 32k records populate my dbgrid Update:  I now know that all the records are there, just the dbgrid control is only displaying up to about 32K of the records - but, there are over 50K records, Is there a way to increase the ability of my dbgrid to show all the records? Alternatives? Also, a second question - what would be the statement to identify the row number of the current selected row? thx in adv ---------------------------------------------------------------------- mangakissa · 2017-01-03 13:16 No. DBGrid is using datasource -> datalink to load amount of data to the grid. It's there but buffered in memory and only shows when needed. But loading 50000 records to your DBGrid is not done. Your asking a lot to the system and no one can see all 50000 records at once. If you want to search then you better can create an search engine to filter your records. QuoteUpdate:  I now know that all the records are there, just the dbgrid control is only displaying up to about 32K of the records - but, there are over 50K records, Are you sure? DBGrid is not show all records directy. ---------------------------------------------------------------------- greertr · 2017-01-03 13:20 it is poss all the records are there, but are displayed in a diff order than Imusd to seeing in my other design tools - how do i get the row number of the last row shown in the dbgrid? (ie, the curr selected row) Yup - all records are there - I used the following code to get the record number of the current selected record... 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 procedure TForm12.Button1Click(Sender: TObject);begin  Label2.caption := 'Number of Selected Record:  ' + inttostr(ZQuery1.RecNo);end; ---------------------------------------------------------------------- ASerge · 2017-01-03 14:50 Quote from: mangakissa on January 03, 2017, 02:16:39 pmYour asking a lot to the system and no one can see all 50000 records at once. +1 50K records is not for users - bad design. Rewrite the program . Possible approaches: Use only 50 (not 50K!) any (usually the first) of the records and to give the opportunity for the user to use the filter.Use 50 records per page and pages navigation, of course with filtering capabilities. ---------------------------------------------------------------------- greertr · 2017-01-03 15:03 thx  aserge - that's what i'm working toward using zeos/sqlite3, does anyone know what the sql query would be to filter a record where a column value, such as airport_ident = edit1.text? get error with 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 select * from airport_frequencies where airport_ident = edit1.text error is "no column titles edit1.text" 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 ZQuery1.Close;ZQuery1.SQL.text:=edit1.text;ZQuery1.Open; this code gives an error about incorrect syntax colon after sql token I'm inserting a screenie to show what I'm tryingto do.  When the user enters in a four letter code into edit1.text, I need to display the relevant records from three tables from the same db. ---------------------------------------------------------------------- mig-31 · 2017-01-03 15:55 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 'select * from airport_frequencies where airport_ident ='+edit1.text ---------------------------------------------------------------------- greertr · 2017-01-03 15:56 thx! P.S.  not sure i used it c not sure, couldnt find orrecly, b/c it didnt work. 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 unit12.pas(75,81) Error: Incompatible type for arg no. 1: Got "AnsiString", expected "TStrings" how to convert ansistring to Tstrings?  not sure, couldnt find. ---------------------------------------------------------------------- Turbonobo · 2017-01-03 17:10 Quote from: mig-31 on January 03, 2017, 04:55:28 pmCode: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i 'select * from airport_frequencies where airport_ident ='+edit1.text  Don't do this! It is bad practice, it will make your application vulnerable to sql- injection and related errors. You should use Parameters instead, using them is also slightly faster. ---------------------------------------------------------------------- greertr · 2017-01-03 18:35 OK, think i solved the conversion issue, but now the code doesn't populate any record to the dbgrid... 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 ZQuery1.SQL.text := 'select * from airports where ident = '+ #39 + FORM2.StringGrid2.CELLS[4,1] + #39; ---------------------------------------------------------------------- greertr · 2017-01-03 20:02 Woot! this code works good... 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   ZQuery1.CLOSE;  //ZQuery1.SQL.text := '';  ZQuery1.SQL.text := 'select * from airports where ident = '+ #39 + FORM2.StringGrid2.CELLS[4,1] + #39;  //I add apostrophe as a char: '...' +#39+ '...'  ZQuery1.OPEN;  //TStrings class is an array of strings, AnsiString is a single string. TStrings has a Text property, which is a string.  Label6.caption := Zquery1.SQL.text; ---------------------------------------------------------------------- JanRoza · 2017-01-03 22:11 Instead of using #39 why not use function QuotedStr()? 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 'select * from airport_frequencies where airport_ident ='+QuotedStr(edit1.text) ---------------------------------------------------------------------- mangakissa · 2017-01-04 07:48 Do it right and use params. Then you don't have to rewrite the query. Query loaded at is buffered into memory and will get faster loaded again. Let's say the basic query in ZQuery1 is Quoteselect * from airport_frequencies where airport_ident = :idThen the result of each filter input could be: 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 procedure FilterQuery(const aValue : string);begin  try     ZQuery1.disablecontrols;     ZQuery1.active := false;     ZQuery1.parambyname('id')ÁsString := aValue;      ZQuery1.active := true;  finally    ZQuery1.enablecontrols;  end;end; Just call the procedure with FilterQuery(edit1.text) ---------------------------------------------------------------------- greertr · 2017-01-04 11:40 thanks, params were above my paygrade, Ill work the params example into my next upgrade.