Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

can data be appended from a cursor?

Status
Not open for further replies.

pxw

Programmer
Jan 6, 2002
86
AU
I tested the following codes. It doesn't work,

select * from table1 into cursor cTemp
select 0
use table2
append from cTemp

Am I doing something wrong or VFP6 doesn't like so? The codes work very well if I use "table", insead of "cursor".

Peter








 

select * from table1 into cursor cTemp
select 0
use table2 && when you do this you are shuting down cursor
append from cTemp


select * from table1 into cursor cTemp
**select 0
use table2 in 0 && this leaves the cursor open
select table2
append from cTemp

use table2
append from table1


Attitude is Everything
 
Make the cursor appear as if it was a table by using the following procedure. Once the prog is ended the cursor goes away.
*----------------------------------------------------------------------------------------------
*PARAMETERS -
* cCursorName = The name of the cursor you created
* cAliasName = The Alais name of the cursor
* Note: once you name the Alias it can be used just as if you were working with a free table
*----------------------------------------------------------------------------------------------
***********************************************************************************************

Procedure UseCursor
lparameters cCursorName, cAliasName

rdbf = DBF(cCursorName)
USE (rdbf) AGAIN ALIAS (cAliasName) IN 0
USE
SELE (cAliasName)
 
Also, don't forget to add the "NOFILTER" clause on the SELECT ... INTO CURSOR ... statement, because without it you may find that the cursor is nothing more than the original table, USE AGAIN'ed, and filtered to what you SELECT'ed.

ie:

The following can sometimes (always?) output "tablename.dbf"
Code:
SELECT * FROM tablename WHERE fld1=5 INTO CURSOR cursorname
SELECT cursorname
?DBF()

 
Many thanks for your responses.

danceman: I have tried the following codes. It still doesn't work properly.

select * from table1 into cursor cTemp nofilter
use table2 in 0
select table2
append from cTemp

The number of record in Table2 is the same as in cursor cTemp. However, all the records are blank, no data at all.


Peter
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top