Board index » delphi » Open/Active DataSets

Open/Active DataSets

Is there a method of making all Datasets in a DM active. ie the
oposite of ADOConnection.CloseDataSets?
I tried iterating thro but this did'nt work.
Thanks,David
 

Re:Open/Active DataSets


Quote
>>I tried iterating thro but this did'nt work.

That's normally how I handle this.  What was the problem you encountered
with this method?

for i := 0 to ComponentCount-1 do
  if components[i] is TDataset then
    TDataSet(Components[i]).Active := True;

=Bill

Re:Open/Active DataSets


Hi, I was trying a different method; produced stack overflow.
Tried yours,as amended;
        begin
        for i := 0 to DMSubcon.ADOConnection1.ComponentCount-1 do
        if components[i] is TDataset then
        TDataSet(DMSubcon.ADOConnection1.Components[i]).Active :=
True;
        end;
But no error messages just datasets not active.I checked
ADOConnection.Active OK
Regards,David

Quote
"WmBurke(TeamB)" <b...@GOSPAMYERSELFComcashpos.com> wrote in message

news:3b0c15a1_2@dnews...
Quote
> >>I tried iterating thro but this did'nt work.

> That's normally how I handle this.  What was the problem you
encountered
> with this method?

> for i := 0 to ComponentCount-1 do
>   if components[i] is TDataset then
>     TDataSet(Components[i]).Active := True;

> =Bill

Re:Open/Active DataSets


Hi David,

The Datasets would be owned by the dm, not the ADOConnection, and so would
be in the DM's components list ie:
//open all datasets in DMSubcon
     begin
        for i := 0 to DMSubcon.ComponentCount-1 do
        if components[i] is TDataset then
          TDataSet(DMSubcon.Components[i]).Active :=
          True;
     end;

=Bill

Quote
"David" <p...@citydrive.co.uk> wrote in message news:3b0c2b02_2@dnews...
> Hi, I was trying a different method; produced stack overflow.
> Tried yours,as amended;
>         begin
>         for i := 0 to DMSubcon.ADOConnection1.ComponentCount-1 do
>         if components[i] is TDataset then
>         TDataSet(DMSubcon.ADOConnection1.Components[i]).Active :=
> True;
>         end;
> But no error messages just datasets not active.I checked
> ADOConnection.Active OK
> Regards,David

> "WmBurke(TeamB)" <b...@GOSPAMYERSELFComcashpos.com> wrote in message
> news:3b0c15a1_2@dnews...
> > >>I tried iterating thro but this did'nt work.

> > That's normally how I handle this.  What was the problem you
> encountered
> > with this method?

> > for i := 0 to ComponentCount-1 do
> >   if components[i] is TDataset then
> >     TDataSet(Components[i]).Active := True;

> > =Bill

Re:Open/Active DataSets


Thanks; I seem to be having a problem with objects
I was trying to work out what was causing an error msg which I assumed
refered to Dsets.
Error Class: EOleException
Error Message: Operation is not allowed when the object is closed
I now realise the Dsets were open,so its not that
David

Quote
"WmBurke(TeamB)" <b...@GOSPAMYERSELFComcashpos.com> wrote in message

news:3b0d63cb$1_1@dnews...
Quote
> Hi David,

> The Datasets would be owned by the dm, not the ADOConnection, and so
would
> be in the DM's components list ie:
> //open all datasets in DMSubcon
>      begin
>         for i := 0 to DMSubcon.ComponentCount-1 do
>         if components[i] is TDataset then
>           TDataSet(DMSubcon.Components[i]).Active :=
>           True;
>      end;

> =Bill

> "David" <p...@citydrive.co.uk> wrote in message

news:3b0c2b02_2@dnews...

- Show quoted text -

Quote
> > Hi, I was trying a different method; produced stack overflow.
> > Tried yours,as amended;
> >         begin
> >         for i := 0 to DMSubcon.ADOConnection1.ComponentCount-1 do
> >         if components[i] is TDataset then
> >         TDataSet(DMSubcon.ADOConnection1.Components[i]).Active :=
> > True;
> >         end;
> > But no error messages just datasets not active.I checked
> > ADOConnection.Active OK
> > Regards,David

> > "WmBurke(TeamB)" <b...@GOSPAMYERSELFComcashpos.com> wrote in
message
> > news:3b0c15a1_2@dnews...
> > > >>I tried iterating thro but this did'nt work.

> > > That's normally how I handle this.  What was the problem you
> > encountered
> > > with this method?

> > > for i := 0 to ComponentCount-1 do
> > >   if components[i] is TDataset then
> > >     TDataSet(Components[i]).Active := True;

> > > =Bill

Other Threads