Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Disappering alias again, what is best solution
Message
From
22/01/2005 01:48:18
 
 
To
20/01/2005 13:18:01
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:
00979544
Views:
11
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
HTH

thomas
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform