General information
Category:
Databases,Tables, Views, Indexing and SQL syntax
You can get unique values by implementing some locking -
one example is the newID.dbc that ships with VFP,
see also "Create a default unique id value for a field" in the Task Pane -> Solution Samples.
hth
-Stefan
>I want to make sure code generation is not repeating codes when using two instaces of the same form
>
>ped_test.dbf is buffered as 5
>
>Then I runned form 1 and form 2 at the same time with
>2 differents instaces of VFP, as below:
>
>
>***********************form 1 code**************************
>SELECT PED_TEST
>DO WHILE PED_TEST.COD < 100000
>
>
>dimension lctemp[1]
>select max(PED_TEST.cod) from PED_TEST ;
> into array lctemp
> lcTemp[1] = nvl(lcTemp[1],0)+1
>
> APPEND BLANK
>
>replace PED_TEST.COD with lctemp
>replace ped_test.id WITH "FORM 1"
> = TABLEUPDATE ()
> LOOP
> ENDDO
>
>
>***********************form 2 code**************************
>
>
>SELECT PED_TEST
>DO WHILE PED_TEST.COD < 100000
>
>
>dimension lctemp[1]
>select max(PED_TEST.cod) from PED_TEST ;
> into array lctemp
> lcTemp[1] = nvl(lcTemp[1],0)+1
>
> APPEND BLANK
>
>replace PED_TEST.COD with lctemp
>replace ped_test.id WITH "FORM 2"
> = TABLEUPDATE ()
> LOOP
> ENDDO
>**********************************************
>
>At the end of the test I have repeated values
>if I browse my two fields table I have something as:
>
>------------------------
>cod ---ID
>------------------------
>
>1000 - FORM 1
>1000 - FORM 2
>1001 - FORM 1
>1001 - FORM 2
>1002 - FORM 1
>1002 - FORM 2 , ETC
>
>
>I would like something as:
>
>
>1000 - FORM 1
>1001 - FORM 2
>1002 - FORM 1
>1003 - FORM 2
>1004 - FORM 1
>1005 - FORM 2 , ETC
>
>Can anybody imagine a better code to run my tests ?
Previous
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only