Recent

Author Topic: ZQuery  (Read 870 times)

greaseflog

  • Newbie
  • Posts: 4
ZQuery
« on: December 06, 2019, 02:52:08 pm »
How can i get the value from SQL.Text when the program is running? I want the value from  file.dfm.

My problem is:
    I have the zquery component  what I use with the zquery with simples query, but I want execute sometime with diferents condicions, with diferents filds. 

Thanks for all.

fjabouley

  • Full Member
  • ***
  • Posts: 103
Re: ZQuery
« Reply #1 on: December 07, 2019, 08:30:02 pm »
Hello !
I'm not sure I correctly understand what you want to do ?
If you want to retrieve the SQL text, just do (yourZquery).SQL.Text ?
If you want to do some other stuff, you can create Zquery at runtime :


Code: Pascal  [Select][+][-]
  1. var query:TZquery;
  2. begin
  3. query := TZquery.Create(nil);
  4. with query do begin
  5. connection := (your TZConnection);
  6. SQL.Clear;
  7. SQL.Add('SELECT BLABLABLA.....');
  8. (eventually ParambyName('your parameter').AsString := ....)
  9.  
  10.  
  11. ExecSQL;
  12.  
  13.  
  14. or
  15.  
  16.  
  17. Open;
  18. while not EOF do begin
  19. (work with FieldbyName('...').Asstring);
  20. Next;
  21. end;
  22. Close;
  23.  
  24.  
  25. Free;
  26. end;
  27.  
  28.  
  29.  


Regards

mangakissa

  • Hero Member
  • *****
  • Posts: 1090
Re: ZQuery
« Reply #2 on: December 09, 2019, 07:43:51 am »
please give some code to tell us what you've done
Lazarus 2.06 (64b) / FPC 3.0.4 / Windows 10
stucked on Delphi 10.3.1

 

TinyPortal © 2005-2018