Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Getting field names into a Comma Delimited File.
Message
De
21/12/1997 14:42:21
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00067402
Message ID:
00067476
Vues:
21
>Greetings All:
>
>I am creating a new table from an existing table with the following SQL
>statement:
>
>SELECT UPSINO AS equipnum, EQUIP_TYPE AS apprtype, MANUFACTUR AS mfr, ;
>SERIAL_NO AS serialnum, SUB_NAME as location, 'OILTRN' as rules ;
>FROM CNAME INTO DBF cnamecnv.dbf ORDER BY UPSINO
>
>I am creating a comma-delimited file from the new table, cnamecnv.dbf, with
>the COPY TO command as follows:
>
>     COPY TO ALIAS()+".txt" TYPE DELIMITED
>
>However, I need the first record of the TXT file to contain the field names
>of the table used to create the TXT file so it will import into my other
>application correctly.
>
>Any suggestions will be appreciated. If you email me, my address is
>elgin@worldnet.att.net
>
>Thank you.
>
>Elgin.
Hi,
Mail merge wizard would do this. But if you want an exe for any dbf you can do it in many ways, here is one :

function exportascii
parameters cTableName, cFieldList && Comma delimited field list - if you want filtering you could add another parm.
if !used(cTableName)
use (cTableName) in 0
endif
select (cTableName)
copy to TempTxt fields &cFieldList type delimited
handle=fcreate(cTableName+".txt")
handle1=fopen("TempTxt.txt")
=fputs(handle1, CfieldList) && If headers need quotes handle it too
do while !feof(handle1)
=fputs(handle,fgets(handle1,65535),65535)
enddo
=fclose(handle)
=fclose(handle1)
erase TempTxt.txt

Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform