Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
VFP Bug: cannot find table causing error in dataenviron
Message
From
21/01/2001 16:41:59
 
 
To
21/01/2001 14:40:05
Dragan Nedeljkovich
Now officially retired
Zrenjanin, Serbia
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00466367
Message ID:
00466397
Views:
11
>>>There's the error event of the DataEnvironment - where you could parse the cursor objects and check which is the first one which refused to open. But then, this is sort of equal to manually creating your DEs, because you'd have to insert this code into the DE of every form you already have, or create your own DE class and then instantiate it for each of your forms. Writing a builder to do this shouldn't be too hard, but then you could just write another one which would insert the error checking code into all of your .scx files DE methods.
>>
>>I'm ready to add a call to generic method into all of my DE
>>Error methods.
>>
>>In Error method, the cursor object does not exist since it cannot be
>>opened.
>>How can I determine then name of this cursor in Error event?
>>Must I open .scx file, find first unopened cursor and assume that
>>this is the cursor causing error? Or is there some simpler way?
>
>The cursor and relation objects exist during the BeforeOpenTables - put any code there, and you will find them.
>
>I don't have the code here, but manipulating cursors in BeforeOpenTables involved something like
>
>
n=amembers(aarray, this, 2)		&& member objects
>for i=1 to n
>   oObj=aarray[i]
>   if oObj.BaseClass='Cursor'
>       [ your code here, involving oObj.Alias etc]
>   endif
>endfor
I addded the following code to dataenvironment.Error method.
Why this code fails: all cursor objects exists but used() returns .f. always!
How to dedect the table causing an error ?
*  dataenvironment.Error method.
LPARAMETERS nError, cMethod, nLine

LOCAL i, aCursors[1], cLastAlias
AMEMBERS(aCursors, thisForm.DataEnvironment, 2)

nUsed = 0

FOR i = 1 to ALEN(aCursors)
  WITH EVAL("thisForm.DataEnvironment." + aCursors[i])
    IF lowe(.BaseClass) != "cursor" 
      loop
      endif
  if used(.Alias)
    nUsed = m.nUsed + 1
    endif
    ENDWITH
 endfor
* nUsed==0 here always.
Andrus
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform