Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Fields' names converting Excel into DBF
Message
From
13/09/2006 08:53:09
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 9
OS:
Windows XP
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01153213
Message ID:
01153260
Views:
23
hi,
thank you very much,
i try it , it works with table ,sometimes i get error message with another table syntax error at
this line
ALTER TABLE (m.t) RENAME COLUMN (m.OldName) TO (m.NewName)&&syntax error 
thanks
regards
m.qasem

>Try (not tested)
>
>
>FOR gnCount = 1 TO FCOUNT( )
>   m.OldName =  FIELD(gnCount)
>   m.NewName = ALLTRIM(EVALUATE(FIELD(gnCount)))
>   ALTER TABLE (m.t) RENAME COLUMN (m.OldName) TO (m.NewName)
>NEXT
>
>
>
>>thank you for reply, and help
>>i try to use FIELD() AND FCOUNT() as under ,in this case i have no idea how i can make alter table for all fileds.
>>
>>thisform.text1.Value=GETFILE('xls')
>>IMPORT FROM (thisform.text1.value) TYPE XLS
>>
>>use JUSTSTEM(thisform.text1.value)
>>m.t=JUSTSTEM(thisform.text1.value)
>>*alter table (m.t)(a
>>CLEAR
>>FOR gnCount = 1 TO FCOUNT( )  && Loop for number of fields
>>   ? FIELD(gnCount)  && Display each field
>>NEXT
>>?
>>? 'Number of fields: ' + ALLTRIM(STR(gnCount -1))&&a,b,c,.....j
>>*CLEAR
>>USE (m.t)
>>? FCOUNT(m.t) &&result is 10
>>
>>alter table(m.t)(A with first column data,B with.....  )
>>
>>
>>thanks.
>>>You can use FIELD() AND FCOUNT() to loop through the fields and ALTER TABLE to rename fileds.
>>>
>>>>
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform