Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Table
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Titre:
Re: Table
Divers
Thread ID:
00453520
Message ID:
00453532
Vues:
14
>Hi Everyone:
> I want to create a table with 32 fields in a tabel. The number of fields in a table could be varry. I am using a For loop to do this,however, it is not working. Can someone please tell me what I am doing wrong?
>
>**Code
>CREATE TABLE salesman ;
> For i = 1 to lnCount && lnCount has the number of fields in a given table.
> ('Field' + Str(i) c(20))
> EndFor
>
>Thanks
>MA

MA,
Build the string first and then use macro substitution to issue it.
lcstring = [CREATE TABLE salesman (]
For ii = 1 to lnCount && lnCount has the number of fields in a given table.
   lcstring  = lcstring + ['Field' ] + transform(i) + [ c(20),]
   if ii = lncount then
      * strip off last ","
      lcstring = left(lcstring,len(lcstring)-1)
   endif
EndFor

* add trailing parenthesis for Create Tabel command
lcstring = lcstring + [)]
&lcstring
You may have to tweak this as I did not test it.

HTH.
Larry Miller
MCSD
LWMiller3@verizon.net

Accumulate learning by study, understand what you learn by questioning. -- Mingjiao
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform