Lazarus

Programming => Databases => Topic started by: Jvan on May 28, 2021, 11:39:39 pm

Title: How to select a record?
Post by: Jvan on May 28, 2021, 11:39:39 pm
After executing my SQL query, how can I get the data row of a record?

Something like this:
Code: Pascal  [Select][+][-]
  1. SQLQuery1.Records[15].Fields[3].AsString;
  2.  
  3.  
Title: Re: How to select a record?
Post by: lucamar on May 28, 2021, 11:49:33 pm
Read it from the query; TSQLQuery is a descendant of TDataset so you can use its Fields and other properties (and methods) to access the data; e.g.:

Code: Pascal  [Select][+][-]
  1. SQLQuery1.RecNo := 15;
  2. SomeString := SQLQuery1.Fields.FieldByNumber(3).AsString;
Title: Re: How to select a record?
Post by: Jvan on May 28, 2021, 11:55:30 pm
Thanks.
TinyPortal © 2005-2018