Recent

Author Topic: Unable to retrieve fields definition from dataset  (Read 398 times)

CrazyRam

  • New Member
  • *
  • Posts: 13
Unable to retrieve fields definition from dataset
« on: June 30, 2019, 12:10:04 am »
Hi,

I am currently following the SQLdb Tutorial, I can view the data in a DBGrid but I want to create a form so that I can view individual records. I understand I should be able to use DBEdit and set the 'DataField'  property in the Object Inspector. However, when I try that I get the error 'Unable to retrieve fields definition from dataset' Any ideas ?

Ram.

Zoran

  • Hero Member
  • *****
  • Posts: 1464
    • http://wiki.lazarus.freepascal.org/User:Zoran
Re: Unable to retrieve fields definition from dataset
« Reply #1 on: June 30, 2019, 12:46:10 am »
Can you connect in design time?

Provide the password to connection component, and everything needed to connect. Then set connected to true.

Then, with active database connection, you should be able to do it.

After that, you can (and should) close the connection, remove the password from object inspector...

CrazyRam

  • New Member
  • *
  • Posts: 13
Re: Unable to retrieve fields definition from dataset
« Reply #2 on: June 30, 2019, 01:00:47 am »
Hi Zoran,

Yes I believe it is connected at design time. Though, the DBGrid is not populated at design time.

I'm using SQLite no password set.

UPDATE:

I've figured it out. Though, 'object SQLTransaction1: TSQLTransaction was set to 'Active = True' & Database 'Connected' was set to true. I also needed to set object SQLQuery1: TSQLQuery to Active to 'True' once I'd set the SQL property to 'select * from CUSTOMER '.

I am now able to 'DataField' the drop down is now populated with the column headers and the DBGrid is also populated at Design Time.
« Last Edit: June 30, 2019, 01:59:32 am by CrazyRam »

mangakissa

  • Hero Member
  • *****
  • Posts: 944
Re: Unable to retrieve fields definition from dataset
« Reply #3 on: July 01, 2019, 08:35:55 am »
When you tell  TSQLQuery to set property  Active to 'True a signal is sent to TSQLConnection to get info from the database you asked. This connection is available untill the moment active is false.
« Last Edit: July 22, 2019, 04:13:16 pm by mangakissa »
Lazarus 1.84 (32b) / FPC 3.0.4
Windows 10

CrazyRam

  • New Member
  • *
  • Posts: 13
Re: Unable to retrieve fields definition from dataset
« Reply #4 on: July 22, 2019, 01:28:07 pm »
Thanks mangakissa.