Board index » delphi » Problems with Closed DataSet. (Active is set True)

Problems with Closed DataSet. (Active is set True)

Hi.

I have a problem in Delphi5E, and I can't find any explanation for it. I'm
sure it's just a small annoying thing.
Maybe you can help !!
The problem occurs when I run the following code.

----------------------------------------------------------------------------
with Notestable do
begin
      SetKey;
      ClearFields;
     ....................;
end;
----------------------------------------------------------------------------

When I try to execute the line SetKey I get an error that says.

EDataBaseError 'Notestable: Cannot perform this operation on a closed
dataset.'

Ok. These kind of errors occurs allways when the TTable component is not set
to Active = True, but the funny thing this time is, that it is allready set
to Active. So it's something else this time.

Can someone explain this to me?

Henrik
Denmark

 

Re:Problems with Closed DataSet. (Active is set True)


I think that if you test the active property in Evaluate/Modify, you'll find
that it's False.  For whatever reason your table is closed.

Paul / ColumbuSoft
www.columbusoft.com

Henrik Meldgaard Frisk <n...@group.inbox.as> wrote in message
news:3a123b6f$1_1@dnews...

Quote
> Hi.

> I have a problem in Delphi5E, and I can't find any explanation for it. I'm
> sure it's just a small annoying thing.
> Maybe you can help !!
> The problem occurs when I run the following code.

> --------------------------------------------------------------------------
--
> with Notestable do
> begin
>       SetKey;
>       ClearFields;
>      ....................;
> end;
> --------------------------------------------------------------------------
--

> When I try to execute the line SetKey I get an error that says.

> EDataBaseError 'Notestable: Cannot perform this operation on a closed
> dataset.'

> Ok. These kind of errors occurs allways when the TTable component is not
set
> to Active = True, but the funny thing this time is, that it is allready
set
> to Active. So it's something else this time.

> Can someone explain this to me?

> Henrik
> Denmark

Re:Problems with Closed DataSet. (Active is set True)


Hi Poul.

You are absolutely right.
If I inserts a breakpoint and use the Evaluate/Modify function the TTable is
set to False at that moment.
That was of cource allso what the error told me, and if I changes the value
to true, it goes well.

But on my form the TTable is still set to true. But somehow when I run the
program, it's not very active anymore. ????
I could insert a line Active := true, but I would really like to find out
why it goes unactive. There most be a good explanation.

Henrik

Quote
"Paul Ferrara" <p...@nospam.columbusoft.com> wrote in message

news:8utfho$pb53@bornews.inprise.com...
Quote
> I think that if you test the active property in Evaluate/Modify, you'll
find
> that it's False.  For whatever reason your table is closed.

> Paul / ColumbuSoft
> www.columbusoft.com

Re:Problems with Closed DataSet. (Active is set True)


| But on my form the TTable is still set to true. But somehow when I run the
| program, it's not very active anymore. ????
| I could insert a line Active := true, but I would really like to find out
| why it goes unactive. There most be a good explanation.

Sounds like a possible create order issue.
If you are opening tables using IDE and have a master detail relationship
then
your create order should have the master table ahead of the detail table.
Furthermore the source for the master table must be created before the
detail table tries to reference it.

If you are opening tables in code (the preferred way), then open master
first
then detail.

If you are not setting master detail relationship in object inspector but
managing this yourself in code MasterDataSource.OnDataChange then
the create order is not important. Using this strategy you would open
the detail first and then the master. Or you can simply assign the dataset
property in code for the masterSource component after all tables are opened.

Garry Kernan

Other Threads