Solved

Paradox tables repeatedly "reverting" on a local install

Posted on 2002-04-19
10
258 Views
Last Modified: 2010-04-04
Hi all,

I have an application which is currently running on just one machine. I am running paradox tables using the BDE. On one table, it seems like after every third or fourth update, the data reverts to a previous state.

The application keeps track of totals of numbers and how they got that way, the 'total' record is updated from a 'charges' record. The next time a 'charge' is made, a new charges records is made and the 'totals' record is updated to reflect what the new total is.

Every so often, the database holding the totals goes back to a previous set of data, from 3, 4, or 5 sets of transactions ago.

I can see the behavior reflected in the data (the charge table keeps track of the total before and after it is updated) but I can't replicate the problem on my machine.

This may be a BDE setting problem, any suggestions? I am currently using posts on the records.

Leo
0
Comment
Question by:oneeye
  • 4
  • 3
  • 3
10 Comments
 

Expert Comment

by:lottol
ID: 6955734
try to add after post next string:

 Table1.FlushBuffers;

where Table1 is your TTable object
0
 
LVL 1

Expert Comment

by:adeng
ID: 6956563
I don't really understand the procedure of updating the record that you're using, can you post your code here.... (but simplify it first)...

Regards
Adeng
0
 

Author Comment

by:oneeye
ID: 6957098
Here is the chunk of code. I'm going to be rewriting it in SQL eventually, but the really odd thing is that it works fine on three machines, but the "ttable" periodically goes back three of four transactions, as I said in the initial problem statement.

   ttable.indexname := 'RankIndex';
   ttable.Edit;
   ttable.first;
   while not ttable.eof do
      begin
      {grab the keys here}
         if chgtable.FindKey([detkey,perkey,listkey]) then
            begin
               ttable.edit;
               if (ttable.fieldbyname('total').asinteger
                  <> chgtable.fieldbyname('newtotal').asinteger)
                  then begin
                     ttable.fieldbyname('datestamp').asdatetime := date;
                     ttable.fieldbyname('timestamp').asdatetime := time;
                  end;
               ttable.fieldbyname('total').asinteger
                  := chgtable.fieldbyname('newtotal').asinteger;
            end
         else ChgTable.insertrecord([1,detkey,perkey,listkey,ttemp,1,ttemp,rankkey]);
         ttable.post;
         chgtable.Edit;
         chgtable.fieldbyname('stamp').asfloat := now;
         filldetailform.ttable.next;
      end;
0
 
LVL 1

Accepted Solution

by:
adeng earned 200 total points
ID: 6957525
here's the first problem :

  ttable.Edit;
  ttable.first;

If you put First procedure after edit then the record will be post..

in the "While not eof" loop, after,
  chgtable.edit;
  chgtable.fieldbyname('stamp').asfloat := now;

you did'nt put "chgtabel.POST"

I don't know here but this line :
  filldetailform.ttable.next;

what if you change it to
  ttable.next; (no filldetailform) ?

BTW, I think TQuery is better then TTable, .

Regards,

Adeng.



0
 

Author Comment

by:oneeye
ID: 6957543
Yes, I quite agree, now that I have started using them. (Tqueries, that is) The stray form declaration happened because for a time, I was getting an unable to find table error.

I'll check to see if the chargetable's are posting properly.

Leo
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

Expert Comment

by:lottol
ID: 6958786
As far, as I've worked with Paradox. It's better to use TTable, not TQuery, because Paradox isn't SQL DB. It just simulates it. Using TQuery takes much time and sometimes it doesn't work correctly.
0
 
LVL 1

Expert Comment

by:adeng
ID: 6958997
You right about that, but in the case of using windows, TQuery is quit stable than TTable. when using TTable and windows, the table crash quite often (index out of date, etc.)
0
 

Expert Comment

by:lottol
ID: 6959607
"Index out of date" happens mostly in those situations, when you copy table "on fly" or don't use exclusive mode for updating records in tables, which are accessed by many users.
I can say that it's impossible to wait queries, if you have multiple users, besides Paradox isn't the best DB for multiple users. :)
0
 

Author Comment

by:oneeye
ID: 6960217
Adenq:

Thanks for the tips on the code, I'll mark it as answered, though in the interim I tracked my problem to another piece of code altogether, heh.

I've been converting this application from using filtered tables to Tquery for the past week or so. The speed difference isn't all that visible on my 2 gig machine, but boy it is obvious on the 300 mhz pIII one of the applications is installed on. Opening up a filtered table takes a 10 count using TTable, it is less than a second opening the same table using a Tquery.

Using Ttable, I kept getting index out of date about once every 3 months, often enough that I wrote a small application to fix it when it happened. If that problem goes away with using mostly read only Tqueries, that will make me very happy.

Leo
0
 
LVL 1

Expert Comment

by:adeng
ID: 6960437
Dear Leo,

Nevermind, nice to help you solve the problem. My project using more than 100 table, very complex logic and more than 4 year in the market, and get no problem very much with paradox table.

Best Regards
Adeng
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
How to use Hibernate  and delphi ? Does anyone know any tutorial? 2 144
Help on project with Soap 10 47
Print Graphic and Text to Epson TM-T88v 12 169
Performance of SQL statement 37 95
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

932 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now