Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Avoiding duplicate records, continuation
Message
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Avoiding duplicate records, continuation
Environment versions
Visual FoxPro:
VFP 9 SP2
Miscellaneous
Thread ID:
01322454
Message ID:
01322454
Views:
73
I gave up using auto increment integer fiels for a while

I continue my war also giving up using a second table to keep
records

I user a timer that executing 2 forms at the same time,
adding data to a table (very quickly, as test)

At the end of the tests I have 2000 records, with no duplications
Seems perfect...

However if I use 3 forms, duplicate numbers accour in some records

I wonder if 2 forms tests are enough or is there anything I could change
below to improve the code

Moises


********** form 1 ***********

SELECT ped

DO WHILE !FLOCK()
ENDDO

dimension lctemp[1]
select max(n) from ped ;
into array lctemp
lcTemp[1] = nvl(lcTemp[1],0)+1
replace ped.n WITH lcTemp
replace ped.n_id WITH "USER 1"

FLUSH
UNLOCK

********** form 2 ***********

SELECT ped

DO WHILE !FLOCK()
ENDDO

dimension lctemp[1]
select max(n) from ped ;
into array lctemp
lcTemp[1] = nvl(lcTemp[1],0)+1
replace ped.n WITH lcTemp
replace ped.n_id WITH "USER 2"

FLUSH
UNLOCK
Next
Reply
Map
View

Click here to load this message in the networking platform