Mega Search
23.2 Million


Sign Up

Make a donation  
Re: can not display data in TIWDBEdit connect to TClientData  
News Group: embarcadero.public.delphi.thirdpartytools.intraweb

I also looked at this thread to work out how to use pooled data modules.  Shame on you AtoZed for not documenting this (ant other) feature!

Here's how to do it:

1. Somewhere (either on your form or User Session Unit) declare a variable referencing your datamodule:

var
  MyDm: TDataModule1;


2. Add the datamodule to the uses clause of this unit.

3. Before you need to use the datamodule, allocate one of the pooled data modules to this varaible:

  MyDm := LockDataModule;

4. Allocate the objects that you use dynamically from this datamodule:

  DataSource1.DataSet := MyDm.FDQuery1;
  DataSource1.Enabled := True;

5. When you're finished using the datamodule, release it back to the pool:

  UnLockDataModule(MyDm);

Note that holding on to your reference to the datamodule for the entire session does not really do anything different than allocating a datamodule to each session.  In otherwords, you need to allocate the datamodule only for the time that you need it and release it as soon as possible afterwards.  I'm not sure how this would work with DB aware controls...I'll guess I'll find out!

Also, UnLockDataModule does not seem to invalidate your reference to a datamodule so unless you are carefull, you could easily end up with two or more sessions referencing the same data module and I'm guessing that might cause some hard to find threading issues.

Steve

> {quote:title=gordon ho wrote:}{quote}
> I have study example IWADOTest_DXE_IW14 and change TADOQuery to TClientDataSet
> and found can not display data in TIWDBEdit connect to TClientDataSet if use pool
> but TIWDBGrid display data normally
> how could I change some property to display data in TIWDBEdit normally

Vote for best question.
Score: 0  # Vote:  0
Date Posted: 17-Jan-2015, at 4:59 PM EST
From: Stephen Corbett
 
Re: can not display data in TIWDBEdit connect to TClientData  
News Group: embarcadero.public.delphi.thirdpartytools.intraweb
> {quote:title=Stephen Corbett wrote:}{quote}
> I also looked at this thread to work out how to use pooled data modules.  Shame on you AtoZed for not documenting this (ant other) feature!

Although it is not documented, there are more than one demo showing how to use the DataModule pool in IntraWeb applications:

http://iwdemos.codeplex.com/SourceControl/latest#Atozed Demos/XIV/Delphi/Database/

Both applications, the Biolife and IWADOPool, demonstrate the usage of the DataModule pool object within an IntraWeb application.

Vote for best answer.
Score: 0  # Vote:  0
Date Posted: 19-Jan-2015, at 8:09 AM EST
From: Alexandre Machado