[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 222
  • Last Modified:

Paradox table not refreshing

I have a Delphi 5 application accessing a paradox dataabase. The database is on a server. I want to get the next invoice number from a table and then incrament it number by one. The application works fine on a single machine but when I try to access the the next number from a different machine the paradox table has not been updates. It is only updatede when the application is turned off. I am using the following sql

insert into invoiceno
  (InvoiceNo)
values
  (:InvoiceNo)  

select max(InvoiceNo) as newNumber from InvoiceNo

Is there a reason why the table does not update across the network. I have cached updates set to false

Thanks
0
fisace
Asked:
fisace
2 Solutions
 
kretzschmarCommented:
>It is only updatede when the application is turned off. I am using
>the following sql

usually caused by misconfigured bde-settings

checks
- netdirpath
  - pointed to a shared directory (read/write access rights)
  - this entry must be char by char the same on all clients

- databasepath (where the tables resides)
  - this entry must be char by char the same on all clients
    (also the driveletter must be the same on all clients)

- local share
    - if above not helps after check and maybe readjustment,
      try the opposite value of this parameter

hope this helps

meikl ;-)  

0
 
geobulCommented:
Hi,

In a multiuser environment I suggest you to create a new table with one record only (and perhaps one field) containing the last given invoice number. Then your application should use a transaction for getting the next number this way:

var InvoiceNo: integer;
begin
...
Database1.StartTransaction;
try
  // get current number
  Query1.Close;
  Query1.SQL.Text := 'SELECT InvoiceNum FROM Table2'; // Table2 is that table
  Query1.Open;
  InvoiceNo := Query1.Field[0].AsInteger;
  Query1.Close;
  // increment the number
  Inc(InvoiceNo);
  // save the new number
  Query1.SQL.Text := 'UPDATE Table2 SET InvoiceNum = ' + IntToStr(InvoiceNo);
  Query1.ExecSQL;
  // do your insert here - insert new record in the invoice table with InvoiceNo
  // ...
  Database1.Commit;
except
  Database1.Rollback;
end;

Regards, Geo
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now