Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Disappering alias again, what is best solution
Message
De
22/01/2005 01:48:18
 
 
À
20/01/2005 13:18:01
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 8 SP1
Database:
Visual FoxPro
Divers
Thread ID:
00978968
Message ID:
00979544
Vues:
10
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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform