Recent

Author Topic: [Solved] Could not convert variant of type (Null) into type (String)  (Read 22581 times)

razor7

  • New member
  • *
  • Posts: 9
    • http://www.mgscreativa.com
Hi...i´m trying to setup a TDBLookupComboBox, using two TSQLite3DataSets (dsClients, dsTreatment)

The clients table has a treatment_id that mus be associated with treatment_id from table treatmets, both are defined as INTEGER, the one in the clients table is also defined as "NOT NULL DEFAULT 1", so never is null or 0.

In my TDBLookupComboBox I had set up
ListSource   dsTreatment
ListField      treatment_txt
KeyField      treatment_id
DataSource dsClients
DataField    treatment_id

When I run my app, the TDBLookupComboBox works as expected (instead showing treatment_id it shows treatment_txt, thats ok) and reacts on pressing TDBNavigator next and previous buttons.

When i click my TDBNavigator insert button I get an exception  "Could not convert variant of type (Null) into type (String)"

Please tell me, what i´m doing wrong?

Thanks a lot!
« Last Edit: August 03, 2010, 07:00:24 am by razor7 »

Lacak2

  • Guest
Re: Could not convert variant of type (Null) into type (String)
« Reply #1 on: August 03, 2010, 06:53:12 am »
IMHO when you press Insert button, new record is appended, so "treatment_id" in "clients" is null at this moment.
and TDBLookupBox is attempting refresh himself ... and error appears.
But it is IMHO bug in TDBLookupBox ?

razor7

  • New member
  • *
  • Posts: 9
    • http://www.mgscreativa.com
Re: Could not convert variant of type (Null) into type (String)
« Reply #2 on: August 03, 2010, 06:59:44 am »
Updated to latest lazarus (Lazarus-0.9.29-26984-fpc-2.4.3-20100803-win32.exe) and the exeption gone...