Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to tell column number and max num columns?
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00505318
Message ID:
00505323
Vues:
20
Hi Brenda,

For number of columns in a table:

LOCAL laMyArray, lnColumns
DECLARE laMyArray[ 1, 16 ]
lnColumns = AFIELDS( laMyArray, "MyTable" )

The array laMyArray now has sixteen columns and one row for each field/column in the MyTable table. Then, to get the column number for a particular name,
you could use a combination of ASCAN() and ASUBSCRIPT() in this manner:

LOCAL lnRow
lnRow = ASUBSCRIPT( laMyArray, ASCAN( laMyArray, "MyFieldName" ), 1 )

The variable lnRow now contains the array row (ie, table column number) of the field/column specified in MyFieldName.

HTH.

>I have a table with many columns. I am in charge with bringing the many years out of date documentation up to date. Would like to know that column abc is column number 121, and would also like to know the number of columns in a table. How can I tell the number of columns a table has and the specific column number for a given column name?
>
>Thanks
>
>Brenda
Evan Pauley, MCP
Positronic Technology Systems LLC
Knoxville, TN

If a vegetarian eats vegetables, what does a humanitarian eat?
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform