Recent

Author Topic: DataSource Dataset selection with seperate DataModule  (Read 10259 times)

iru

  • Sr. Member
  • ****
  • Posts: 328
DataSource Dataset selection with seperate DataModule
« on: June 05, 2012, 06:26:41 am »
Gentlefolk,

Environment is WinXP & SP3, Laz 0.9.30.4.

I have form with a DataSource.
All database (ZEOS) objects are in a seperate DataModule.

What option/setting in the environment/project or other setting do I have to enable so that when I select the Datasource>Dataset field in the Object Inspector the ZEOS objects in the DataModule are displayed?

This is working in another project but I cannot remember or find what is required to make it work.

Thanks, Ian.

ludob

  • Hero Member
  • *****
  • Posts: 1173
Re: DataSource Dataset selection with seperate DataModule
« Reply #1 on: June 05, 2012, 08:59:11 am »
Adding the datamodule to the uses clause of the form is enough.

iru

  • Sr. Member
  • ****
  • Posts: 328
Re: DataSource Dataset selection with seperate DataModule
« Reply #2 on: June 05, 2012, 10:44:52 am »
Thank you for the response, I thought it was something like that.

However, in the application I have a main form and a frame.

In the main form the Datasource>Dataset displays the ZEOS objects in the datamodule.

In the frame the Datasource>Dataset does NOT display the datamodule objects.

I have checked the interface "uses" statements in the form and the frame, they both contain the name of the datamodule.

I have a small test application with a main form and a frame. I added a data module and one ZEOS object.

Added a Datasource to the form and frame. Clicked on the Dataset in both the form and frame. The ZEOS object in the data module was displayed in both the form and frame.

Good news but, the datamodule name was not in any interface "uses" statement.

Closed the project (saving changes), re-opened the project and the Datasets would not display in either the form or the frame.

Even worse, I added the name of the the datamodule to both the form and frame and the Dataset was NOT displayed.

Something is odd/flakey/whatever.

I will pursue it further.....

Ian.


iru

  • Sr. Member
  • ****
  • Posts: 328
Re: DataSource Dataset selection with seperate DataModule
« Reply #3 on: June 05, 2012, 12:46:13 pm »
Gentlefolk,

Checked all sorts of things in the simple test setup of a mainform, frame and datamodule.

Could not get any Datasource>Dataset to display the ZEOS object from the DataModule.

Added a datasource to the DataModule, on that datasource I could see the ZEOS object on the DataModule.

Checked the datasource on the form and frame and could also see the ZEOS object on the DataModule.

Deleted the datasource on the DataModule, could still the ZEOS object on the DataModule. Saved the project, re-opened, could still see the ZEOS object.

Back on the main program, added a Datasource to the data and voila, could display the Dataset on a Datasource on both form and frame.

Unfortunately this is not consistent behaviour, could display once or twice and then no more after doing things in the editor. I cannot consistently get the Datasource>Dataset to work in the frame.

Ian

ludob

  • Hero Member
  • *****
  • Posts: 1173
Re: DataSource Dataset selection with seperate DataModule
« Reply #4 on: June 05, 2012, 04:43:50 pm »
Did also some testing with forms, frames and datamodules and I don't even have to add the data module to the uses clause to see the datasets and datasources listed. There is btw a bug report that is complaining about this since, when using multiple data modules, you always get all components listed http://bugs.freepascal.org/bug_view_advanced_page.php?bug_id=18825

I'm using lazarus 1.1



iru

  • Sr. Member
  • ****
  • Posts: 328
Re: DataSource Dataset selection with seperate DataModule
« Reply #5 on: June 07, 2012, 01:03:05 am »
One step forward, two back?

I downloaded Laz 1.1 and ZEOS 7.0 (using that rather than 6.6 to get around another issue).

Tried to install the Package>Zcomponent and the install crashes with an error:

Module: ZClasses.
Line: 84:   TContainedObject = class(TAggregatedObject, IInterface)
Error: Class not found.

More research required........

Ian

iru

  • Sr. Member
  • ****
  • Posts: 328
Re: DataSource Dataset selection with seperate DataModule
« Reply #6 on: June 08, 2012, 06:14:02 am »
Gentlefolk,

I find that this error is a known issue as discussed in the forum entry
  Topic: Zeoslib - can't compile and install  (Read 1541 times)
and is caused by a change
  IUnknown.QueryInterface has changed. It uses now constref iid:tguid. Before it was const iid:tguid.

The forum entries suggested getting zeos code from CODETYPHOON or using a recent version of zeos via SVN.

I have tried the zeos-SVN approach but still get the same error.
Will think about codetyphoon.

Ludob, what version of zeos are you using with laz 1.1?

Ian

ludob

  • Hero Member
  • *****
  • Posts: 1173
Re: DataSource Dataset selection with seperate DataModule
« Reply #7 on: June 08, 2012, 06:59:03 am »
Ludob, what version of zeos are you using with laz 1.1?
Zeos 7.0.0-dev from svn : svn co https://zeoslib.svn.sourceforge.net/svnroot/zeoslib.  If you don't want to use svn, a tarball can be downloaded from http://zeoslib.svn.sourceforge.net/viewvc/zeoslib/trunk/?view=tar

iru

  • Sr. Member
  • ****
  • Posts: 328
Re: DataSource Dataset selection with seperate DataModule
« Reply #8 on: June 08, 2012, 02:15:02 pm »
Thank you for the response.

That is the SVN-ZEOS that I used. So I still have a problem.

Downloded CodeTyphoon, installed clean (?).

Loaded my project, attempted to compile, same error.
Looked at the project inspector, there was an exclemation mark against the ZComponent file.

Deleted ZEOS, attempted to install the package again (from CodeTyphoon), package would not install.

Something is wrong with my Lazarus environment?????? Something somewhere??????

I will build a new virtual machine and do some clean installs.

This may take some time as I am about to go walking in the mountains for a couple of weeks and am undecided whether to take the laptop and Internet access may be a problem.

Thanks for the help, Ian.

ludob

  • Hero Member
  • *****
  • Posts: 1173
Re: DataSource Dataset selection with seperate DataModule
« Reply #9 on: June 08, 2012, 02:49:33 pm »
What version of fpc are you using?
Quote
Module: ZClasses.
Line: 84:   TContainedObject = class(TAggregatedObject, IInterface)
Error: Class not found.
In zeos 7.0.0 that code is in a {$IFDEF OLDFPC} {$ENDIF} block. OLDFPC is set for fpc<=2.2.4
Quote
Downloded CodeTyphoon, installed clean (?).

Loaded my project, attempted to compile, same error.
Looked at the project inspector, there was an exclemation mark against the ZComponent file.
In codetyphon the Zeos component is called pl_ZeosDBO. The name changed to highlight the changes pilotlogic made to the standard Zeoslib.
Quote
This may take some time as I am about to go walking in the mountains for a couple of weeks and am undecided whether to take the laptop and Internet access may be a problem.
Don't. Enjoy the hike ;)

iru

  • Sr. Member
  • ****
  • Posts: 328
Re: DataSource Dataset selection with seperate DataModule
« Reply #10 on: June 10, 2012, 09:52:43 am »
I created a new virtual machine and installed CodeTyphoon.

Started Lazarus, opened my project and tried to compile.

Woops, things stopped on my datamodule at the "uses" line which contains all the ZEOF module names.

No error message, no message window (even though it showed in the "windows" list).

Chased up CodeTyphoon, know issue with window size specification in an xml file somewhere.

Also looked up the project inspector, there is ZConnectiondb with a red dot on the icon.

It is late and time to get a plane to the mountains, back in a couple of weeks.

Ian

 

TinyPortal © 2005-2018