Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Problem: DBC locked when opening view in dataenvironment
Message
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00510887
Message ID:
00511409
Views:
19
This message has been marked as a message which has helped to the initial question of the thread.
Joel,

I had this and in the end used a 'doForm' function that does a number of retries, something like the listing below. It's not pretty (my excuse!) but I've found that it usually only fails once, the error being cleared by the second attempt.
	set reprocess to 2 seconds

*added for version 2.1.1
local oldEHandler, e, nRetries, nMaxTries,m
	nMaxTries = 6
	oldEhandler = on("error")
	e = 0
	nRetries = 0
	=rand(-1)
	on error e = error()
	DO FORM (lcFileName) NAME this.aForms[this.nFormCount] LINKED NOSHOW
	do while ((e <> 0) and (nRetries < nMaxTries))
		m = str(e) + " - Retrying: " + alltrim(str(nRetries)) + " of " + alltrim(str(nMaxtries)) 
		nRetries = nRetries + 1
		doevents		
		statusMsg(m)
		=inkey(.2+rand())
		e = 0
		DO FORM (lcFileName) NAME this.aForms[this.nFormCount] LINKED NOSHOW
	enddo
	clearMsg()
	on error &oldEHandler
>Most of you already know about the problem that can occur when multiple users try to open or requery a view using a shared DBC. The most common solution seems to be to install a copy of the DBC on each user's workstation. We would rather leave the DBC shared on the server if possible, especially since my tables and local views are in the same DBC, and all of my forms already access that DBC. So, I've tried a couple of things, but VFP internally seems to ignore my efforts.
>
>My first attempt was to SET REPROCESS TO -2 (AUTOMATIC). But VFP doesn't seem to take this setting into account when opening/requerying a view, and doesn't retry the DBC lock.
>
>So I tried to trap the error and to retry the operation. This works for Error 1709 "Database object is being used by someone else". However, a different error occurs when VFP tries to open the view through the dataenvironment of a form: Error 2005 "Error loading file - record number 29. frmForm .Loading form or the data environment : Database object is being used by someone else". When the error handler issues the retry, VFP doesn't try to re-open the view or the form. As above, this looks like another case where an internal VFP operation cannot be handled externally.
>
>Is there another solution to this problem? As I said earlier, I'd like to avoid the hassles of installing the DBC on each workstation, but I'll do it if it's the only way.
>
>Thanks.
Previous
Reply
Map
View

Click here to load this message in the networking platform