Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Database container damaged
Message
De
13/06/2002 01:31:19
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00636400
Message ID:
00667776
Vues:
13
Dear Jim

According to your suggestion I have developed the following module but there is some thing wrong with me.

There is a table PID.DBF with one field PID and two records
1st record - last PID No.(Personnal Identification No.)
2nd record - last Bill No.

another table BILL.DBF which contain Bill record.

To generate unique PID No. and unique Bill No. I have written the
following routine where if PID No. already exists then it is not generated.

*============
select 0
do while .t.
use pid alias pid EXCLUSIVE
if USED("pid")
exit
endif
enddo
if len(alltrim(temp.pid)) = 0
select pid
go top
m.lastpid = pid.pid
mpd = val(substr(m.lastpid,2,6))
m.pdno="P"+padl(alltrim(str(mpd+1,6,0)),6,"0")
replace pid.pid with m.pdno
else
m.pdno = temp.pid
endif

select pid
go bottom
mbno = val(left(pid.pid,6))
m.bno=padl(alltrim(str(mbno+1,6,0)),6,"0")
replace pid.pid with m.bno

select pid
use

*===============
then BILL.DBF is open exclusive and record is added with bill no. - m.bno

The programme is excuted from three node simultaneously and approx 700 bill are generated daily.
But in a day there will surely 3 or 4 duplicate bill no.

Can you tell me where I am wrong.

Thanking you

Aritra Roychoudhury
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform