Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
The best way to insert a record in Multi-user environmen
Message
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00918800
Message ID:
00924950
Views:
14
Hi Jim, Hi Neil,

Sorry for being so rude and not replying message for a long time.

I've been frightfully busy with additional work. I ran tests using each method runing simultaniusly from 3 workstations saving to the same table. And the second method which is the buffered one seems worked much faster and got all the records into the table.

Thank you both so much for your replies,

>Dawa,
>
>Is the Windows 2000 "server" actually the server version of the OS or the PRO version? If the pro version then I believe that the max. simultaneous 'share' count is 10 and that might have some impact.
>
>Is this a form, and are you using private datasessions. If yes to both (and maybe even if not, especially considering the COMponent) have you ceded an explicit SET EXCLUSIVE OFF? Possibly you are defaulting to ON.
>
>good luck
>
>
>
>>Hello All,
>>
>>I have a multi-user vfp application in the following architecture:
>>
>>- The database resides on drive c: of a server (Window 2000) ;
>>- VFP applications are installed on the workstations (about 30 workstations) which are connected to the server.
>>- The app opens the database through a mapped drive to access the database
>>- I also have foxisapi installed on the server and internet users are accessing the database through a COM component I created in VFP.
>>
>>My problem is that users are getting error 108 ("File in use by another user") because when they try to add a new record.
>>
>>I have devloped couple approaches:
>>
>>First one:
>>
>>  set reprocess to automatic
>>  public _gaerror(1,7)
>>  on error aerror(m._gaerror)
>>  use table1 shared
>>  cursorsetprop('buffering',1) && no buffering
>>  local i
>>  for i = 1 to 1
>>    m._gaerror = 0
>>    if rlock('0','table1') ;
>>    then
>>      insert into table1 ;
>>        (field1) values (m.lnValue)
>>      unlock record 0 in table1
>>    else
>>      if m._gaerror(1,1)=108 ; && If the file is locked by another user try again
>>      then
>>        i = i - 1 && keep trying till succed
>>      endif
>>    endif
>>  next
>>  use in table1
>>
>>
>>Second one:
>>
>>  set multilocks on
>>  set reprocess to 1 && try locking once
>>  sys(3051,500) && try at every 500 miliseconds
>>  sys(3052,1,.t.) && index locking honors reprocess setting
>>  sys(3052,1,.t.) && memo locking honors reprocess setting
>>  public _gaerror(1,7)
>>  on error aerror(m._gaerror)
>>  use table1 shared
>>  cursorsetprop('buffering',3) && optimistic row buffering
>>  insert into table1 ;
>>    (field1) values (m.lnValue)
>>  local i
>>  for i = 1 to 1
>>    m._gaerror = 0
>>    if not tableupdate(2,.t.,'table1') and ;
>>      m._gaerror(1,1)=108 ; && If the file is locked by another user try again
>>    then
>>      i = i - 1 && keep trying till succed
>>    endif
>>  next
>>  use in table1
>>
>>
>>Theoretically, as long as table1 was not opened exclusively by another user this should work. But in reality, it doesn't seem to do the trick.
>>
>>Is there a third approach that grantees the record inserting?
>>
>>Any help will be greatly appreciated!
>>
>>Dawa
Dawa Tsering


"Do not let any unwholesome talk come out of your mouths,
but only what is helpful for building others up according to their needs,
that it may benefit those who listen."

- Ephesians 4:29-30 NIV

Dare to Question -- Care to Answer

Time is like water in a sponge, as long as you are willing you can always squeeze some.

--Lu Xun, Father of Modern Chinese Literature

Previous
Reply
Map
View

Click here to load this message in the networking platform