Board index » delphi » Paradox application : losing records.

Paradox application : losing records.

Hi,

it seems that when a customer installs my paradox application, he's losing
data if he closes the application whith the bordericon 'X' instead of
closing the forms with exit buttons. It seems that the records are not
written to the database directly, but into some memory.
Is it possible for me to put some code into my program so that customers do
not have to care about this at all ?
And that customers should not change any settings by themselves, f.ex. in
Control panel, etc...
--
Filip Willems
(mailto : filip.will...@advalvas.be)

 

Re:Paradox application : losing records.


  It sounds as if you have code to clean up your database that does not get
executed when simply closing the app.  You can take a couple approaches to
fix this: for one, you could keep a variable in memory that you inspect in
OnCloseQuery in order to prevent closing if you have not properly closed out
the database (assuming you have provided some standard way to do that, like
an Exit button or something). Or, you could move your code that does that
cleanup to your OnClose event so that it always executes.

  One question...is this an MDI app?  Closing the main form like that in an
MDI app causes a different behavior for the child windows events...if this
is the case then you'll want to provide a way to close out the child windows
before allowing the main window to close..that way the child windows can do
whatever data cleanup they were executing.

-Howard

Re:Paradox application : losing records.


Hi, Howard,
yes, it's an MDI application. The child window closes the database in the
"On Close" event.
Losing records is when the master form is closed with the 'X' bordericon,
without closing the childs first.
Phil

--
Filip Willems
(mailto : filip.will...@advalvas.be)

Quote
"Howard Moon" <hm...@landstar.com> wrote in message news:3c71121a_1@dnews...
>   It sounds as if you have code to clean up your database that does not
get
> executed when simply closing the app.  You can take a couple approaches to
> fix this: for one, you could keep a variable in memory that you inspect in
> OnCloseQuery in order to prevent closing if you have not properly closed
out
> the database (assuming you have provided some standard way to do that,
like
> an Exit button or something). Or, you could move your code that does that
> cleanup to your OnClose event so that it always executes.

>   One question...is this an MDI app?  Closing the main form like that in
an
> MDI app causes a different behavior for the child windows events...if this
> is the case then you'll want to provide a way to close out the child
windows
> before allowing the main window to close..that way the child windows can
do
> whatever data cleanup they were executing.

> -Howard

Re:Paradox application : losing records.


  That's because the app closing call sequence is not the same for MDI.

  What we did was write code in our FormDestroy of the child form that would
detach from the database, as well as in the OnClose.  Then, we would set a
flag in that "DetachDatabase" procedure that would tell us if we needed to
detach in the FormDestroy.  Like this:
   if not DatabaseDetached then
    DetachDatabase.

  This is because when you close the MDI app that way, you don't get a
FormClose of the children, but you *do* get a FormDestroy.

  I suppose you could use the FormClose of the main form if using OnDestroy
is too late for you work (i.e., if you access any controls whose windows
handle is destroyed by that time).

  The big problem is that you need to make sure that your solution for
closing via the 'x' does not affect closing via the menu or other methods.

  Hope this helps some...
-Howard

Re:Paradox application : losing records.


Set Local Share to True in the BDE Administrator to disable the BDE's write
cache.

--
Bill
(TeamB cannot answer questions received via email)

Re:Paradox application : losing records.


Hello,
What would fix this is , to set local share to true in the BDE Admin. Or
after each post for each Table call DBISaveChanges(TableX.Handle). Either
solution will work for you. They both save all changes directly to the
Hdrive not to a buffer . This will also save you the trouble if the user
shuts down the program abnormally.

" Phil Di Guillielmo" <removethis_filip.will...@advalvas.be> wrote in
message news:3c70cdfe_1@dnews...

Quote

> Hi,

> it seems that when a customer installs my paradox application, he's losing
> data if he closes the application whith the bordericon 'X' instead of
> closing the forms with exit buttons. It seems that the records are not
> written to the database directly, but into some memory.
> Is it possible for me to put some code into my program so that customers
do
> not have to care about this at all ?
> And that customers should not change any settings by themselves, f.ex. in
> Control panel, etc...
> --
> Filip Willems
> (mailto : filip.will...@advalvas.be)

Re:Paradox application : losing records.


Hi Bill,
does this mean that I have to do this on every pc from the our customers, or
only in design mode at my place ?
If 1., can I do it by code, because I do not expect that every customer will
do this action in control panel... ?
Phil

--
Filip Willems
(mailto : filip.will...@advalvas.be)
"Bill Todd (TeamB)" <bill_nos...@dbginc.com> wrote in message
news:3c717fd6_2@dnews...

Quote
> Set Local Share to True in the BDE Administrator to disable the BDE's
write
> cache.

> --
> Bill
> (TeamB cannot answer questions received via email)

Re:Paradox application : losing records.


  Every PC needs to have this done.  You can do it from an installation
program, though.  Check the newsgroups (via Google.com is a quick way to
search) for details on setting the BDE settings from code.  (Alternatively,
you would do it manually using the BDE Admin app that's part of the BDE
install.)
-Howard

Re:Paradox application : losing records.


Local Share must be set on every PC. To see how to do it in code see the
examples for DbiOpenCfgInfoList at www.borland.com/devsupport/bde/bdeapiex .

--
Bill
(TeamB cannot answer questions received via email)

Re:Paradox application : losing records.


Thanks Bill,
I think I'll try to work with DbiSaveChanges first.
Phil

--
Filip Willems
(mailto : filip.will...@advalvas.be)
"Bill Todd (TeamB)" <bill_nos...@dbginc.com> wrote in message
news:3c72b2ef$1_2@dnews...

Quote
> Local Share must be set on every PC. To see how to do it in code see the
> examples for DbiOpenCfgInfoList at www.borland.com/devsupport/bde/bdeapiex
.

> --
> Bill
> (TeamB cannot answer questions received via email)

Re:Paradox application : losing records.


Excellent, just what the doctor orders....
Thanxz.

--
Filip Willems
(mailto : filip.will...@advalvas.be)

Quote
"bcb" <noem...@sorry.com> wrote in message news:3c71aa76_2@dnews...
> Hello,
> What would fix this is , to set local share to true in the BDE Admin. Or
> after each post for each Table call DBISaveChanges(TableX.Handle). Either
> solution will work for you. They both save all changes directly to the
> Hdrive not to a buffer . This will also save you the trouble if the user
> shuts down the program abnormally.

> " Phil Di Guillielmo" <removethis_filip.will...@advalvas.be> wrote in
> message news:3c70cdfe_1@dnews...

> > Hi,

> > it seems that when a customer installs my paradox application, he's
losing
> > data if he closes the application whith the bordericon 'X' instead of
> > closing the forms with exit buttons. It seems that the records are not
> > written to the database directly, but into some memory.
> > Is it possible for me to put some code into my program so that customers
> do
> > not have to care about this at all ?
> > And that customers should not change any settings by themselves, f.ex.
in
> > Control panel, etc...
> > --
> > Filip Willems
> > (mailto : filip.will...@advalvas.be)

Other Threads