Recent

Author Topic: Get Dataset fielddefs names into string list?  (Read 853 times)

tatamata

  • Hero Member
  • *****
  • Posts: 787
    • ZMSQL - SQL enhanced in-memory database
Get Dataset fielddefs names into string list?
« on: March 24, 2020, 02:12:32 pm »
Hello,
Can we get a dataset's fielddefs names into a list, without iteration?

mangakissa

  • Hero Member
  • *****
  • Posts: 1131
Re: Get Dataset fielddefs names into string list?
« Reply #1 on: March 24, 2020, 02:16:05 pm »
tsqlquery.GetFieldNames
Lazarus 2.06 (64b) / FPC 3.0.4 / Windows 10
stucked on Delphi 10.3.1

lucamar

  • Hero Member
  • *****
  • Posts: 4219
Re: Get Dataset fielddefs names into string list?
« Reply #2 on: March 24, 2020, 05:55:48 pm »
Note that GetFieldNames() is a method of TDataSet, so it should work for any TDataSet descendant, not only for TSQLQuery.

Also, you can access the TField themselves, after getting their names with GetFieldNames(), with method GetFieldList().
Turbo Pascal 3 CP/M - Amstrad PCW 8256 (512 KB !!!) :P
Lazarus/FPC 2.0.8/3.0.4 & 2.0.12/3.2.0 - 32/64 bits on:
(K|L|X)Ubuntu 12..18, Windows XP, 7, 10 and various DOSes.

 

TinyPortal © 2005-2018