Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Disappering alias again, what is best solution
Message
From
22/01/2005 17:03:57
 
 
To
22/01/2005 01:48:18
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 8 SP1
Database:
Visual FoxPro
Miscellaneous
Thread ID:
00978968
Message ID:
00979683
Views:
12
>Hi Andrus,
>
>I suspect that workarea number and dbf() are bugfree, and only sometimes the alias is wrong.
>This is based on my expiriences with tables opened and not set to the specified alias.
>
>When I trapped the errorcondition with an assert the ways to handle became obvious -
>so the first I'ld recommend is an
>
>
assert alias()=="DOKSUMMA" Mess "Select has lost it's alias - Debug Time!"
>
>directly after the line if IRINA can work on version(2)=2.
>
>Otherwise I'ld go for a specific function to fix the alias on a newly created cursor based on the ways to create read/write cursors back in vfp6 without the READWRITE clause.
>
>Something like
>function FixCursorAlias(tcAlias)
>*-- expects to be called on the workarea in question
>*-- or add a second workarea parameter
>tcAlias = upper(alltrim(m.tcAlias))
>if alias()==m.tcAlias
>   = strToFile(Transform(select()) + m.tcAlias + "!=" + Alias() + "$$$" + dbf(), "AliasErr.txt")
>   local lnOldArea, lnNewArea, lcDbf
>   lcDbf = dbf()
>   lnOldArea = select()
>   * Since we had an error, be extra careful and
>   * do everything here slowly with one line for each operation
>   select 0
>   use (m.lcDBF) again alias (m.tcAlias)
>   Do While !alias()==m.tcAlias
>      DoEvents && add other stuff here, perhaps more protocol
>      use (m.lcDBF) again alias (m.tcAlias)
>   enddo
>   lnNewArea  = select()
>   select (m.lnOldArea)
>   use
>   select (m.lnNewArea)
>endif
Thomas,

This error occurs in runtime, after hundreds of successful running the same code.

I don't understand your routine.

I can dedect the the required alias (created maybe thousands of lines of code before in a different class method) does not exist.

I cannot execute the method which create the alias since some other cursors and data required to create this are destroyed.

So it seems that only thing which I can do is to add lines
IF !USED('DOKSUMMA')
  MESSAGEBOX( 'Please try this command again' )
  RETURN .F.
  ENDIF
before the lines where this error must frequently occurs. Those places can be determined by line numbers from log file if exe is created with a debuf info.
Andrus
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform