Board index » delphi » Help: records deleted form paradox tables

Help: records deleted form paradox tables

In a Delphi 5 database application it seems to me that tables lose
data record, occasionally.
I have a TDatabase component, in order to change the alias name at
runtime.
I add records to tables, post them explicitly, and monitor the table
via database |explore. Ok. I close both the application, and the
compiler.
But in some cases, I do not understand when and why, but not always,
all or some records get deleted, and tables become empty.
Why? could it be an effect of (misuse of) TDatabase?
I had InsertRecord + Cancel (in order to prepare a new record for the
user, and give him the possibility of canceling the operation); but
now I have removed this.
Thank you.
PM
 

Re:Help: records deleted form paradox tables


Quote
pm...@optec-srl.com (PiEmme) wrote in message <news:4d059c13.0211140143.4581d531@posting.google.com>...
> In a Delphi 5 database application it seems to me that tables lose
> data record, occasionally.
> I have a TDatabase component, in order to change the alias name at
> runtime.
> I add records to tables, post them explicitly, and monitor the table
> via database |explore. Ok. I close both the application, and the
> compiler.
> But in some cases, I do not understand when and why, but not always,
> all or some records get deleted, and tables become empty.
> Why? could it be an effect of (misuse of) TDatabase?
> I had InsertRecord + Cancel (in order to prepare a new record for the
> user, and give him the possibility of canceling the operation); but
> now I have removed this.
> Thank you.
> PM

Is localShare set to true?  
When set to true, the data is written to the harddrive.

Do you have in the onClose of your main form:

If dmData.MyTable.State in [dsInsert, dsEdit] then dmData.MyTable.Post;
dmData.MyDatabase.Commit;

HTH,

John

Re:Help: records deleted form paradox tables


I understand that admdta.MyDatbase.Open and .StartTransaction are
required, otherwise .Commit fails. But also .Open fails!
What does localShare refer to? I do not find documentation.
This is not a client- server application. I use TDatabase only to
change the alias at runtime. Is this use correct?
Thanks.
PM
Quote
pm...@optec-srl.com (PiEmme) wrote in message <news:4d059c13.0211140143.4581d531@posting.google.com>...
> In a Delphi 5 database application it seems to me that tables lose
> data record, occasionally.
> I have a TDatabase component, in order to change the alias name at
> runtime.
> I add records to tables, post them explicitly, and monitor the table
> via database |explore. Ok. I close both the application, and the
> compiler.
> But in some cases, I do not understand when and why, but not always,
> all or some records get deleted, and tables become empty.
> Why? could it be an effect of (misuse of) TDatabase?
> I had InsertRecord + Cancel (in order to prepare a new record for the
> user, and give him the possibility of canceling the operation); but
> now I have removed this.
> Thank you.
> PM

Re:Help: records deleted form paradox tables


Quote
"PiEmme" <pm...@optec-srl.com> wrote in message

news:4d059c13.0211180008.2eb8283e@posting.google.com...

Quote
> I understand that admdta.MyDatbase.Open and .StartTransaction are
> required, otherwise .Commit fails. But also .Open fails!
> What does localShare refer to? I do not find documentation.
> This is not a client- server application. I use TDatabase only to
> change the alias at runtime. Is this use correct?
> Thanks.
> PM

LocalShare is a setting in the Borland Database Engine (BDE).

Do a search on Google or any big Delphi site and you should find articles on
the best settings for BDE and Paradox tables. Paradox tables can suffer from
data loss and index corruption if you don't get the settings right.

Hope this helps,
Dave.

Dave Murray
Glasgow, UK

Re:Help: records deleted form paradox tables


Quote
pm...@optec-srl.com (PiEmme) wrote in message <news:4d059c13.0211180008.2eb8283e@posting.google.com>...
> I understand that admdta.MyDatbase.Open and .StartTransaction are
> required, otherwise .Commit fails. But also .Open fails!
> What does localShare refer to? I do not find documentation.
> This is not a client- server application. I use TDatabase only to
> change the alias at runtime. Is this use correct?
> Thanks.
> PM

> pm...@optec-srl.com (PiEmme) wrote in message <news:4d059c13.0211140143.4581d531@posting.google.com>...
> > In a Delphi 5 database application it seems to me that tables lose
> > data record, occasionally.
> > I have a TDatabase component, in order to change the alias name at
> > runtime.
> > I add records to tables, post them explicitly, and monitor the table
> > via database |explore. Ok. I close both the application, and the
> > compiler.
> > But in some cases, I do not understand when and why, but not always,
> > all or some records get deleted, and tables become empty.
> > Why? could it be an effect of (misuse of) TDatabase?
> > I had InsertRecord + Cancel (in order to prepare a new record for the
> > user, and give him the possibility of canceling the operation); but
> > now I have removed this.
> > Thank you.
> > PM

Lets start at the easy stuff:

A)Setting Local Share := True:
  1)Open the BDE Administrator (found in Control Panel).
  2)Click on the Configuration Tab.
  3)Click on the + sign next to System.
  4)Click on INIT.
  5)ON the right side is a list of parameters click in the Local
Share, choose
True.

This forces the Data to be written to the database (physically), no
missing stuff on close.  This is what I think you whole problem is.

B)The use of TDatabase:
Double-click on the TDatabase component.
Fill in the fields like this:
the quoted text is what I used and you can use what you like instead
with no quotes.

Name "VHSData2"  Alias Name (leave blank, the whole point of this
exercise)
Driver name STANDARD

Parameter overrides:
"PATH=C:\Program Files\JohnK\VHS Library\Tables"
DEFAULT DRIVER=PARADOX
ENABLE BCD=FALSE

Options  check or unchecked as you see fit.

Click okay.  You will have to create a directory on your drive to
match your path and store/create your Tables in it.

In the Object Inspector changing "Connected" to True should cause no
errors.  If it does, I have no idea how you can Post anything to the
Tables.

Your TTable components should have the name ("VHSData2") in their
DatabaseName property.

Commit/Rollback/StartTransaction is used when you also have
"CachedUpdates" set to TRUE on your TTable components.

HTH,

John

Other Threads