Recent

Author Topic: Strange error. With TDBLookupComboBox and TDBLookupListBox. In TIBConnect-SQLdb.  (Read 15739 times)

xcod

  • New Member
  • *
  • Posts: 13
Strange error. With TDBLookupComboBox and TDBLookupListBox.
In TIBConnect-SQLdb.
to reproduce, drop:
IBConnection, SQLTransaction, SQLQuery, Datasource, DBLookupComboBox or DBLookupListBox.
In DBLookupComboBox or DBLookupListBox set ListSource-DataSource, Listfield-any, KeyField-any and run in runtime or designtime. Error DataBase connect string (DataBaseName) not filled in!
sorry for my bad English.
example in attached.
Lazarus SVN 1.1 37682, FPC 2.7.1

ludob

  • Hero Member
  • *****
  • Posts: 1173
The error message is quite clear. You have to fill in DataBaseName in TIBConnection before you can connect. DataBaseName is the .fdb or .gdb filename, including path.

xcod

  • New Member
  • *
  • Posts: 13
Yes, but if i want fill DataBaseName in runtime. I dont want fill DataBaseName in designtime.
if i dont fill DataBaseName in designtime, result an error
sorry for my bad english...
« Last Edit: June 25, 2012, 05:24:06 pm by xcod »

exdatis

  • Hero Member
  • *****
  • Posts: 668
    • exdatis
If you want to pick database, simple way is *.ini file with paths and hosts,
and use that at run time, and default db, at design time(before any, run dialog to pick database which you want at runtime).
(Just ComboBox, with sections).
Regards.
p.s. Of course(Ludob said) database_name is necessary (if you need connection)!
« Last Edit: June 26, 2012, 08:01:42 am by exdatis »

xcod

  • New Member
  • *
  • Posts: 13
Yes. But i dont want use *.ini file. I want manually fill in DataBaseName in runtime.
And another, if i delete value in KeyField (DBLookupComboBox or DBLookupListBox), when you start not result an error, and i set value in KeyField after start in runtime. Also, if you delete DataSource not result an error after start.
Lazarus SVN 1.1 37682, FPC 2.7.1 WIN32
Sorry for my bad English...

xcod

  • New Member
  • *
  • Posts: 13
This error occurs only with a DBLookupComboBox and DBLookupListBox.
With others DBCtrls, error does not occur.
sorry for my English..

BigChimp

  • Hero Member
  • *****
  • Posts: 5740
  • Add to the wiki - it's free ;)
    • FPCUp, PaperTiger scanning and other open source projects
What happens if you set all db control's active to false during design time and set them to true when starting the application?
Want quicker answers to your questions? Read http://wiki.lazarus.freepascal.org/Lazarus_Faq#What_is_the_correct_way_to_ask_questions_in_the_forum.3F

Open source including papertiger OCR/PDF scanning:
https://bitbucket.org/reiniero

Lazarus trunk+FPC trunk x86, Windows x64 unless otherwise specified

xcod

  • New Member
  • *
  • Posts: 13
Quote
if you set all db control's active to false
How to do it?
DBLookupComboBox not have properties "Active"
How do it  DBLookupComboBox not active?
I making a video of this error http://youtu.be/oQp4upDftFY

BigChimp

  • Hero Member
  • *****
  • Posts: 5740
  • Add to the wiki - it's free ;)
    • FPCUp, PaperTiger scanning and other open source projects
Have you tried the Connected property then? Or some similar property?

Alternatively, as mentioned, use a test database during development, then code your application so it sets the database to your desired database on runtime.

If deleting a datasource doesn't give errors, perhaps your controls are not bound to the datasource.

Have you looked at the documention and tutorials, such as the SQLDBTutorial1 article on the wiki?
Also, in the options, you can set the object inspector showhints (or something) to true.
If there is help for this property (and you defined the help path etc correctly), it will show help on the property in the box in the lower part of the object inspector.
Want quicker answers to your questions? Read http://wiki.lazarus.freepascal.org/Lazarus_Faq#What_is_the_correct_way_to_ask_questions_in_the_forum.3F

Open source including papertiger OCR/PDF scanning:
https://bitbucket.org/reiniero

Lazarus trunk+FPC trunk x86, Windows x64 unless otherwise specified

xcod

  • New Member
  • *
  • Posts: 13
I tested in another a database. I use TDBF.
On the form TDbf, Datasource and DBLookupcombobox
and error repeated same
In previous(svn 37117) version Lazarus was no error.
This is error reproduced only in DBLookupcombobox and DBLookupListBox.
I also tested with UIB components, error reproduced.
I think the problem is not in a specific database.
I think the problem in TDatasource.

BigChimp

  • Hero Member
  • *****
  • Posts: 5740
  • Add to the wiki - it's free ;)
    • FPCUp, PaperTiger scanning and other open source projects
Ok, if you have a small test program with data, you could file a bug report in the bugtracker (see left).
Please indicate operating system, platform etc, and the problem description/analysis you wrote in your last post...

I would make sure to mention that the error occurs both with dbf and uib components - but a test program with dbf attached to the bug makes it of course much easier for devs to check the issue.

Thanks.
Want quicker answers to your questions? Read http://wiki.lazarus.freepascal.org/Lazarus_Faq#What_is_the_correct_way_to_ask_questions_in_the_forum.3F

Open source including papertiger OCR/PDF scanning:
https://bitbucket.org/reiniero

Lazarus trunk+FPC trunk x86, Windows x64 unless otherwise specified

xcod

  • New Member
  • *
  • Posts: 13
I create report in bugtracker and described steps to reproduce
http://bugs.freepascal.org/view.php?id=22337

BigChimp

  • Hero Member
  • *****
  • Posts: 5740
  • Add to the wiki - it's free ;)
    • FPCUp, PaperTiger scanning and other open source projects
Regarding issue 22337: the issue is closed so I can't comment there...

First: if the program, however deficient, worked in Lazarus r 37117 there is a change in behaviour. The question is of course whether this is important.
Edit: actually, I think xcod used invalid property values as a nice way to demonstrate that entering this will lead to the problems mentioned.

Had a look at the Firebird test program and changed it: added valid SQL for TSQLQuery, added valid lookup field/list field for combobox (used employee.fdb demo database).

Apparently just having a TDBLookupComboBox on the form will force the connection to be opened in runtime - see attached program.
Compare with the same program with a tdbedit instead of a tdblookupcombobox: the connection stays closed.

Is that the way this should work?

Edit: if so, please link to or write the relevant documentation. This is going to make it hard to set up your components in design time, have a look at the data etc, set the connection to disconnected and set up e.g. a login form or something.
You'd have to remember clearing the relevant fields in your combo boxes/list boxes and assigning them via code.
Seems complicated.

However, xcod & I may surely be missing something...
« Last Edit: July 03, 2012, 11:40:41 am by BigChimp »
Want quicker answers to your questions? Read http://wiki.lazarus.freepascal.org/Lazarus_Faq#What_is_the_correct_way_to_ask_questions_in_the_forum.3F

Open source including papertiger OCR/PDF scanning:
https://bitbucket.org/reiniero

Lazarus trunk+FPC trunk x86, Windows x64 unless otherwise specified

ludob

  • Hero Member
  • *****
  • Posts: 1173
Had also a look at TDBFSample2 attached to the issue. Can't write any comments on the issue neither but here are my findings (you may want to refer to these when re-opening the issue):
- TDBLookup.Initialize, called after being loaded, will open FListLink.DataSet. Since the Dataset is not loaded yet, TDataset.SetActive will set FOpenAfterRead. TDBLookup.Initialize will continue and end with setting FListLink.DataSet.Active := False; . Problem is that the latter does not reset FOpenAfterRead. When the Dataset loads, FOpenAfterRead is still set and the DataSet will try to open and raises an exception (missing file). This exception is not caught anywhere and the program halts.
- TDBLookup.Initialize does call FListLink.DataSet.Open inside a try except but the FOpenAfterRead delayed opening does make the exception occur outside this try except
- I can't find any recent changes in Lazarus that can cause this. Did you change the fpc version also or only lazarus?

Edit: As expected from previous observations the order of loading the components is important. I changed manually the lfm file to first have object Dbf1: TDbf and then object DBLookupComboBox1: TDBLookupComboBox. The exception is now raised inside the try except and the application does not halt.
So I think that the component creation order change triggered the error, not lazarus revision 37117 or later.

If suggest you re-open the issue with above information.
« Last Edit: July 03, 2012, 12:03:58 pm by ludob »

LuizAmérico

  • Sr. Member
  • ****
  • Posts: 457
Thanks for the new sample, it's clearer now

I fixed the problem in svn.

Regarding the behavior of automatically opening the List Dataset: this is a feature of LCL since delphi does not do it.

Personally i don't like this feature due to problems like this and the complexity added but i kept to maintain compatibility with older versions of LCL.

If it was only for me, i would remove this feature and let user decide when to open  the dataset.

 

TinyPortal © 2005-2018