Recent

Author Topic: TSQLquery.CreateDataSet raises the error "SQL statement not set"  (Read 515 times)

dpap

  • New Member
  • *
  • Posts: 12
I'm tying to cretate a table in a SQLite database usisnf a TSQLquery component with some fieldDefinitions. I use SQLquery1.CreateDataSet but I receive the error in theme. I supposed that defining the fields was enough. What is my error ?

The help says "CreateDataset uses the FieldDefs and Fields properties to determine which property contains the structure for the dataset". So why wants the SQL statement?
« Last Edit: January 10, 2025, 05:26:15 pm by dpap »

cdbc

  • Hero Member
  • *****
  • Posts: 1786
    • http://www.cdbc.dk
Re: TSQLquery.CreateDataSet raises the error "SQL statement not set"
« Reply #1 on: January 10, 2025, 05:58:15 pm »
Hi
'TSQLquery' is based on TBufDataset, i.e.: it inherits the ability to act like a 'TClientDataset'.
I think 'CreateDataset' stems from TBufdataset, but what you want to use is actually a SQL database, with 'TSQLquery', thus it wants you to fill in the 'TSQLquery.Sql.Text' with a "CREATE TABLE IF NOT EXIST Sometablename ..." statement and the call ExecSql;
HTH
Regards Benny
If it ain't broke, don't fix it ;)
PCLinuxOS(rolling release) 64bit -> KDE5 -> FPC 3.2.2 -> Lazarus 2.2.6 up until Jan 2024 from then on it's: KDE5/QT5 -> FPC 3.3.1 -> Lazarus 3.0

 

TinyPortal © 2005-2018