Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Ilya Rabyy
  Where is Ilya Rabyy?
 Fountain Valley
 California - United States
 Ilya Rabyy
 To: Jun Tangunan
  Where is Jun Tangunan?
 Cabanatuan
 Philippines
 Jun Tangunan
 Tags
Subject: RE: COPY TO [file] nullifies field value
Thread ID: 395961 Message ID: 396224 # Views: 32 # Ratings: 0
Version: Visual FoxPro 9 SP2 Category: Databases, Tables and SQL Server
Date: Thursday, January 23, 2014 7:22:11 PM         
   


> > Colleagues,
> >
> > I've never seen such behavior: some fields are nullified upon a cursor's being saved into a DBF file on disk!
> > Here's what's going on:
> > I have a cursor, populated in the code (with INSERT INTO C_CURSOR FROM MEMVAR) in a cycle;
> > I set a STEP ON after the end of that cycle to check the contents of one particular field;
> > Checking this field (numeric) after cycle's completed - the value is correct (non-zero);
> > Some additions to this cursor (client's store's attributes) in the code, check this field again - the value is still correct (non-zero);
> > I COPY TO (SomePath\C_COPY.DBF), checking this field again (right after that command) - bloody hell, it's Zero! :-@
> > As well as couple other fields that weren't zero in the cursor before copying it into a DBF! :-@:-@
> >
> > Here's the actual code:
> >
> >
***** Debug *****
> > IF _VFP.StartMode==0
> >    SET STEP ON
> > ENDIF
> > *****************
> > SELECT CO_STATE && Just in case
> > ** Preserve the resulting cursor
> > COPY TO (m.gcCompanyPath + [CO_STATE.DBF]) ALL

> > Whatever I tried - the result was the same: this particular field turns to zero at the moment it's been copied into a DBF file on disk.
> >
> > Any idea why this might be happening, and how I can fix it?
> >
> > AHWBGA!
> >
> > Regards,
> >
> > Ilya
>
>
> Although I am wondering why you are using a cursor for the purpose of later copying it to a table of its own anyway and not just work straight on a table, I won't ask anymore. ;-)
>
> However, I would prefer the SQL SELECT ... INTO TABLE way than the COPY TO approach you've shown above:
>
>
SELECT * from myCursor INTO TABLE myTable
> 

>
>
>
>
> https://vfpx.codeplex.com/releases/view/99045
> http://sandstorm36.blogspot.com

If it were up to yours truly, I wouldn't copy this darn cursor into a file on disk at all!
Alas! I have to, coz another program (quite old, and written in C++ or ancient C#) uses it for printing. (Don't ask me why/what/who was it who designed it this way - I dunno. Neither I have the source code... :-( )

Anyway, "thanks for the tip, bro!" (Rob Malcolm to Chris Cole in "Rock Star" film of 2001 ;-) )

Regards,

Ilya

ENTIRE THREAD

COPY TO [file] nullifies field value Posted by Ilya Rabyy @ 1/21/2014 10:01:40 PM
RE: COPY TO [file] nullifies field value Posted by Ali Koumaiha @ 1/21/2014 10:29:37 PM
RE: COPY TO [file] nullifies field value Posted by Ali Koumaiha @ 1/21/2014 10:30:22 PM
RE: COPY TO [file] nullifies field value Posted by Ilya Rabyy @ 1/21/2014 10:47:41 PM
RE: COPY TO [file] nullifies field value Posted by Pete Sass @ 1/22/2014 1:11:30 AM
RE: COPY TO [file] nullifies field value Posted by Ilya Rabyy @ 1/22/2014 4:51:28 PM
RE: COPY TO [file] nullifies field value Posted by Pete Sass @ 1/22/2014 6:56:30 PM
RE: COPY TO [file] nullifies field value Posted by Tore Bleken @ 1/22/2014 11:35:59 AM
RE: COPY TO [file] nullifies field value Posted by Ilya Rabyy @ 1/22/2014 4:46:38 PM
RE: COPY TO [file] nullifies field value Posted by Rick C. Hodgin @ 1/22/2014 5:32:21 PM
RE: COPY TO [file] nullifies field value Posted by Pete Sass @ 1/22/2014 6:53:42 PM
RE: COPY TO [file] nullifies field value Posted by Ilya Rabyy @ 1/22/2014 7:38:46 PM
RE: COPY TO [file] nullifies field value Posted by Gene Wirchenko @ 1/22/2014 8:02:19 PM
RE: COPY TO [file] nullifies field value Posted by Ilya Rabyy @ 1/22/2014 8:13:59 PM
RE: COPY TO [file] nullifies field value Posted by Gene Wirchenko @ 1/23/2014 7:27:13 PM
RE: COPY TO [file] nullifies field value Posted by Ilya Rabyy @ 1/23/2014 10:42:08 PM
RE: COPY TO [file] nullifies field value Posted by Gene Wirchenko @ 1/24/2014 8:07:43 PM
RE: COPY TO [file] nullifies field value Posted by Tore Bleken @ 1/24/2014 8:43:37 PM
RE: COPY TO [file] nullifies field value Posted by Ilya Rabyy @ 1/24/2014 8:54:55 PM
RE: COPY TO [file] nullifies field value Posted by Tore Bleken @ 1/24/2014 11:24:07 PM
RE: COPY TO [file] nullifies field value Posted by Ilya Rabyy @ 1/24/2014 8:44:14 PM
RE: COPY TO [file] nullifies field value Posted by Pete Sass @ 1/22/2014 9:08:35 PM
RE: COPY TO [file] nullifies field value Posted by Ilya Rabyy @ 1/22/2014 11:47:25 PM
RE: COPY TO [file] nullifies field value Posted by Rick C. Hodgin @ 1/22/2014 9:46:21 PM
RE: COPY TO [file] nullifies field value Posted by Ilya Rabyy @ 1/22/2014 11:53:11 PM
RE: COPY TO [file] nullifies field value Posted by Vilhelm-Ion Praisach @ 1/22/2014 5:36:06 PM
RE: COPY TO [file] nullifies field value Posted by Ilya Rabyy @ 1/22/2014 7:31:26 PM
RE: COPY TO [file] nullifies field value Posted by Vilhelm-Ion Praisach @ 1/22/2014 8:02:21 PM
RE: COPY TO [file] nullifies field value Posted by Jun Tangunan @ 1/23/2014 4:33:59 AM
RE: COPY TO [file] nullifies field value Posted by Ilya Rabyy @ 1/23/2014 7:22:11 PM