Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Maximum string length?
Message
De
02/03/2006 17:51:18
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
01100026
Message ID:
01101108
Vues:
20
The code I gave you was for illustration only. The filespec is not hard coded. It is input by the user via a filepicker class similar to

lcSourceTable = GETFILE()

Thus the variable has the full filespec in it. I could use juststem or justfile to get just the filename but since the original table is not likely in the current directory I would have to be marching all over the disk to find it. Opening the table prior to the SELECT gives me the handle I need to close it but requires an extra step that I was hoping to avoid.


>Don,
>
>
>Never hardcode any path in your code or you'll have a lot of work when time comes to change it. You can store the path as a property of your application object. This way you'll have to change it in one place only, if necessary.
>I consider it a good programming practice to open tables explicitly and reference them by there alias in a query.
>lcTable = 'mytable'
>IF NOT USED(lcSourcetable)
>  USE (oApp.cDataPath + lcTable) IN 0
>ENDIF
>SELECT * from (lcTable) into cursor crsNew
>USE IN (lcTable)
>
I'm not sure why do you have to close a table to make it available to other programs. Are you running your program with
SET EXCLUSIVE ON
?
>
>>I'm probably breaking protocol here but since you helped me with an earlier part on this I thought it might be OK to ask you directly,
>>
>>If I SELECT from a table that is not currently open into a cursor, the source table is opened in the process. If the source table is in a variable, how can I then close it so it is available to other programs?
>>
>>lcSourcetable = 'd:\mydir\mytable'
>>SELECT * from (lcsourcetable) into cursor crsNew
>>** release the source table
>>use in (lcSourceTable) && doesn't seem to work
>>
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform