Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
HELP!!! This code works in debug but not in program.
Message
De
17/09/1998 07:57:46
John Baird
Coatesville, Pennsylvanie, États-Unis
 
 
À
17/09/1998 00:08:22
Larry Long
ProgRes (Programming Resources)
Georgie, États-Unis
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00137460
Message ID:
00137722
Vues:
32
>>All you guru's out there:
>>
>>The following code has two programmers completely stumped. The code fails to USE the indicated database right before the suspend in the following code snippet. It loops through this code 4 times and fails each time on the use. Then the select fails because it can't find the table.
>>
>>One other thing, the method's error handler picks up an error 'Structural index not found'. These files are downloaded from a vendor's ftp site and have no index files associated with them. If I use the same macro expansion from the code window, it runs just fine.
>>
>>However, if I place a suspend in the code before the &lcCmd macro, and run it from there, each table is used, and the the indexes created.
>>
>>
>>What's going on??
>>
>>
>>
>>FOR lnIndex2 = 1 TO ALEN(aCursors,1)
>>  lcCurName = ALLTRIM(aCursors(lnIndex2,2))
>>  lcExt = ALLTRIM(UPPER(SUBSTR(aCursors(lnIndex2,3),                        RAT('.',aCursors(lnIndex2,3))+1)))
>>
>>  DO CASE
>>     CASE lcExt == 'DBF'
>>	&tcCnt..lblStatus.Caption = 'Creating data table from ' +                   ALLTRIM((aCursors(lnIndex2,3)))
>>	lcFile = UPPER(thisform.cSourceDir +                                    ALLTRIM(aCursors(lnIndex2,3)))
>>	lcVar = ALLTRIM(aCursors(lnIndex2,5))
>>	lcTag = ALLTRIM(aCursors(lnIndex2,4))
>>	lcCmd = 'USE '  + lcFile  + ' IN 0 ALIAS  ' + lcCurName
>>	&lcCmd
>>
>>	SELECT (lcCurName)
>>	lcIndexCommand = 'INDEX ON ' + lcVar + ' TAG ' + lcTag
>>	&lcIndexCommand
>>     ENDCASE		
>>ENDFOR
>>
>1) What are sample values of cSourceDir, lcCurName and table name that is giving problems?
>2) Re:Your second question.
>Do you have tables set up as part of a database which is open at the time your app is running, that have the same name as the downloaded files? If so, your app may be expecting to find indexes that were defined in your database. This also may be related to you first problem.



cSourceDir was: 'e:\orderlnk\techdata\'
lcCurName was: 'cGroup'
lcFile was: 'COMMGRP.DBF'

No duplicate table names.

Solved the problem late last night, though. Seems like the ON ERROR handler was causing some kind of problem. When we issue ON ERROR prior to running this loop and then turn ON ERROR &lcOnError, the code runs perfectly.

Thanks for the suggestion......
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform