>Thanks a lot for your answer.
>
>I tried to make a test class programmatically :
>
>DEFINE CLASS test_class AS custom OLEPUBLIC
> PROCEDURE Init
> SET EXCLUSIVE OFF
> *SET DATASESSION TO 1
> USE C:\TEST1\TEST.DBF IN 0 SHARED
> ENDPROC
>
> PROCEDURE INSERT_RECORDS
> FOR i=1 TO 1000
> INSERT INTO TEST VALUES (i,ALLTRIM(STR(i)))
> ENDFOR
> ENDPROC
>
>ENDDEFINE
>
>
>From the VFP command window I called the method INSERT_RECORDS as follow :
>
>OX=CREATEOBJECT('PROJ1.TEST_CLASS')
>OX.INSERT_RECORDS
>
>Everything is ok
>
>Then I opened another VFP and i tried the same thing but I get "File is in Use"
>
That's because the session is public as you've defined it; try:
DEFINE CLASS test_class AS custom OLEPUBLIC
DATASESSION=2
PROCEDURE Init
SET EXCLUSIVE OFF
USE C:\TEST1\TEST.DBF IN 0 SHARED
ENDPROC
PROCEDURE INSERT_RECORDS
FOR i=1 TO 1000
INSERT INTO TEST VALUES (i,ALLTRIM(STR(i)))
ENDFOR
ENDPROC
ENDDEFINE