Home General
New Blog Posts: Merging Reports - Part 1 and Part 2

How to set the database's Connected property to False?

edited May 2002 in General
Hi,

Every time I enter the report editor and then leave it the Connected
property of a databases which provides data to that report is left set to
True. Is it possible force it to False after I leave the RB report editor?

Thank you
Janusz

Comments

  • edited May 2002
    Hi Janusz,

    this isn't a ReportBuilder issue. Your connection component should provide
    this feature.
    If you are a component designer, you could write a descendant that overide
    the 'stored' attribute of 'Connected' (a really simple task for a component
    designer).

    regards,
    Chris Ueberall;
  • edited May 2002
    Hi Chris,

    Do I understand you properly - _before_ I enter the RB editor the connetion
    is set to False. Then I enter RB editor, edit my report, leave it and I see
    the connection is changed to True.
    I think that's RB which changes the state of the connetion component in this
    case - am I wrong?
    Shouldn't it restore it to the old value?

    Thank you very much
    Janusz


  • edited May 2002
    Janusz,

    It isn't ReportBuilder that changes the connection's 'Active' property, the
    connection is opened by any of the used datasets.
    The Designer is not a modal window and there is really no point of time when
    the designer could decide to close the connection. In addition,
    ReportBuilder has no idea how to close the connection one used in conclusion
    with the datasets. I think, it could be implemented via the database
    sensitive plugin units, but once again, this would be the wrong place.
    I don't know why a database connection or any dataset should store its
    'Open' property, but once a dataset is opened during design time it should
    stay opened until I decide to close the connection.
    Did you ask the designer of your connection component why this property is
    stored?

    regards,
    Chris Ueberall;

  • edited May 2002
    Hi Chris,

    I think I should have been more clear, sorry. I use DBISAM TDatabase, DBISAM
    TTable, TDataSource, TppDBPipeline and TppReport components on my report
    form.
    Now, it is not so much important that database connetion turns to True. More
    frustrating is that TTable Active property is left with True value after I
    close the report designer because I continuously forget about it and get the
    error when trying to open the TTable when I run the program. There is a nice
    TppDBPipeline property CloseDataSource which makes exactly what I want but
    in the case of destroying TppDBPipeline - after I delete TppDBPipeline the
    database connection is still true, but TTable is closed. I was suggested by
    this behaviour and thought the similar can be achieved with TppReport - to
    have the mechanism to close the TTables used by report when closing the
    report designer.


    In fact that property is not stored by itself when no other changes are made
    to the form - but this is not the usual situation. Normally I do some
    changes when I open the report designer. Then I leave it, forget to turn off
    the TTable Active property, save my changes and end up with the error when I
    run the program and try to open the table once again.

    Thank you for your patience
    Janusz

    set
  • edited May 2002
    Janusz,


    It was clear to me!

    create a package with the following two descendants and install it.
    This has been my way since 'stored' was born.

    type
    TjcDatabase = class(TDataBase)
    published
    property Connected stored False;
    end;

    TjcTable = class(TTable)
    published
    property Active stored False;
    end;

    I hope you'll get the idea,
    Chris Ueberall;
  • edited May 2002
    Chris,

    It works great! Just what I wanted to have. Thank you for your help!

    Janusz
This discussion has been closed.