COPY FIELDS TO with variable

Post Reply
Marc Vanzegbroeck
Posts: 1102
Joined: Mon Oct 17, 2005 5:41 am
Location: Belgium
Contact:

COPY FIELDS TO with variable

Post by Marc Vanzegbroeck »

Hi,

If I do

Code: Select all

copy fields NTWKNUM,NODENUM,MODNUM,SLOTNUM,NAME,PTDESC,KEYWORD,NODETYP,POINT_TYPE TO c:\temp\tpsdoc.dbf
it's working like expected.

Now I want the fields coming from a variable like this

Code: Select all

vvelden = "NTWKNUM,NODENUM,MODNUM,SLOTNUM,NAME,PTDESC,KEYWORD,NODETYP,POINT_TYPE"
copy fields (vvelden) TO c:\temp\tpsdoc.dbf
It's not doing anything, I also get no error.

I already tried with

Code: Select all

vvelden = "NTWKNUM,NODENUM,MODNUM,SLOTNUM,NAME,PTDESC,KEYWORD,NODETYP,POINT_TYPE"
copy fields &vvelden TO c:\temp\tpsdoc.dbf
Also without any result.
Is it possible with a variable?
Regards,
Marc

FWH32+xHarbour | FWH64+Harbour | BCC | DBF | ADO+MySQL | ADO+MariaDB | ADO+SQLite
User avatar
karinha
Posts: 4882
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: COPY FIELDS TO with variable

Post by karinha »

Code: Select all


       Formats: COPY TO <file> [<scope>] [FIELDS <list>] [FOR <expL>]
                       [WHILE <expL>] [TYPE <file_type>]
                COPY FILE <file1> TO <file2>
                COPY STRUCTURE TO <file> [FIELDS <list>]
                COPY TO <file> STRUCTURE EXTENDED

       COPY TO copies database records to another file.

       COPY <file> copies any file to another file.

       COPY STRUCTURE copies a database structure to another database.

       COPY TO ... STRUCTURE EXTENDED copies a database structure into
               another database, one record per field.

 
João Santos - São Paulo - Brasil
Marc Vanzegbroeck
Posts: 1102
Joined: Mon Oct 17, 2005 5:41 am
Location: Belgium
Contact:

Re: COPY FIELDS TO with variable

Post by Marc Vanzegbroeck »

João,

I know that is the format, but I wanted to store the fields in a variable, because, I want the fields, depending of the content of a database.

That was not working with the command.

I found a solution with __dbCopy

Code: Select all

vvelden := { "NTWKNUM","NODENUM","MODNUM","SLOTNUM","NAME","PTDESC","KEYWORD","NODETYP","POINT_TYPE" }
 __dbCopy( "c:\temp\tpsdoc1.dbf", vvelden ,,,,, .F., )
 
Regards,
Marc

FWH32+xHarbour | FWH64+Harbour | BCC | DBF | ADO+MySQL | ADO+MariaDB | ADO+SQLite
Post Reply