Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
OLE Public Server - Single Use
Message
From
30/04/2002 05:52:17
 
 
To
30/04/2002 02:04:35
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Miscellaneous
Thread ID:
00650244
Message ID:
00650775
Views:
24
>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 SESSION OLEPUBLIC
   DATASESSION=2  && explicitly set a private datasession since
                  && the default is to the default public datasession
   PROCEDURE Init
      SET EXCLUSIVE OFF
      *SET DATASESSION TO 1
      USE C:\TEST1\TEST.DBF IN 0 SHARED AGAIN
   ENDPROC
	
   PROCEDURE INSERT_RECORDS
      FOR i=1 TO 1000
         INSERT INTO TEST VALUES (i,ALLTRIM(STR(i)))
      ENDFOR
   ENDPROC
	
ENDDEFINE
EMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater


NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC

The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform