Database component is not assigned

All about the Doxygen documentation for Zeoslib.
Links to the downloads and online version.

Moderators: gto, bravecobra

Post Reply
mochhenry
Fresh Boarder
Fresh Boarder
Posts: 1
Joined: 23.12.2011, 02:37

Database component is not assigned

Post by mochhenry »

when i use TZConnection in the same form this error doesnot show.
when i use TZConnection in the datamodule this error always show.

can you help me please.

:( :( :( :(

lazarus 0.9.28
zeos 6.6.6
ubuntu 10.04
Zoran
Senior Boarder
Senior Boarder
Posts: 55
Joined: 07.05.2010, 22:32

Post by Zoran »

I cannot reproduce this problem. I put ZConnection1 on DataModule1, set the properties so that it connects to data base, then I put ZReadOnlyQuery1 on form1, set ZReadOnlyQuery1.Connection to DataModule1.ZConnection1, set SQL to a select statement and everything works well.

Why do you use Lazarus version 0.9.28, which is more than two years old? Maybe the problem is there.
I tried with "stable" Lazarus 0.9.30.2 and 0.9.31 from trunk.

Does the problem appear in design time or in runtime?
papelhigienico
Expert Boarder
Expert Boarder
Posts: 113
Joined: 06.10.2006, 14:41
Location: Chapecó - Santa Catarina
Contact:

Post by papelhigienico »

Check the creation order and if the datamodule was put on auto-create forms list.
User avatar
mdaems
Zeos Project Manager
Zeos Project Manager
Posts: 2766
Joined: 20.09.2005, 15:28
Location: Brussels, Belgium
Contact:

Post by mdaems »

I second papelhigienico's view. This error usually comes from the datamodule being created after the form instance is created.

Mark
Image
jwhitten
Fresh Boarder
Fresh Boarder
Posts: 6
Joined: 16.07.2013, 14:56

Post by jwhitten »

I know this is a response to an old thread but...

In my experience, when you get the "Database connection is not assigned" error, it means that you left a dataset (TZTable, TZQuery, whatever) in the "Active" (Active := True) state before running the program. IMO, this should not be a problem, but it happens to me quite frequently and that's what I've discovered quickly fixes the issue. Just go in, select 'em all, and set them to False and it will probably work after that-- assuming you really are hooking them up with a connection of course.

BTW, in case anybody's wondering, I'm using Zeosdb 7.4 something or other, a very recent copy from subversion, along with Lazarus 1.0.10. So this issue is definitely still around.

John
Post Reply