Is there no no way to move it to a private data session from the default.
Main Topics
Browse All TopicsCan i move data from one cursor to another if they are in different data sessions, if it's possible how do i do this. (VFP 7)
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Cursors are also tables on disk but a session has exclusive access to it. In other words you can't directly pass cursors between sessions but you can pass objects between sessions. If your cursor has data to fit in an array :
Set DataSession to _screen.DatasessionID
select myCursor
copy to array aTransfer
Set DataSession to thisform.DatasessionID
select myCursor
append from array aTransfer
ie:
Select * From customer Into Cursor myCursor
Public oForm
oForm = Createobject('myForm') && oForm has private data session
oForm.Show
Define Class myForm As Form
DataSession = 2
Add Object cmdGetData As CommandButton With ;
Caption = 'Get Data From Another Session', ;
AutoSize = .T.
Add Object myGrid As Grid With Top = 30, ColumnCount=2
Procedure Init
Create Cursor crsLocal (Cust_id c(6), Company c(40))
This.myGrid.RecordSource = 'crsLocal'
Endproc
Procedure cmdGetData.Click
Local lnSession
With Thisform.myGrid
.RecordSource = ''
lnSession = thisform.DataSessionId
Set DataSession To _Screen.DataSessionId
Select myCursor
Copy To Array aTransfer
Set DataSession To m.lnSession
Insert into crsLocal from Array aTransfer
Select crsLocal
locate
.RecordSource = 'crsLocal'
Endwith
Endproc
Enddefine
With objects you might transfer huge cursors too but generally there is no need to make huge transfers between sessions.
If there's too much data to transfer using arrays and copying the cursor to an intermediate temporary file seems too slow then you could go back to record oriented processing.
Set DataSession to nCopyFromSession
select copyCursor
scan
scatter memvar memo
Set DataSession to nDestinationSession
inssert into destCursor from memvar
Set DataSession to nCopyFromSession
endscan
Or altenatively again, use copyCursor again in 0
In the destination data session.
Business Accounts
Answer for Membership
by: CaptainCyrilPosted on 2004-05-28 at 14:05:25ID: 11184231
As long as one of the data sessions is not private.
SELECT cursor2
APPEND FROM DBF('cursor1') && append from another cursor
or
SELECT * FROM cursor1 INTO CURSOR cursor2 && query one cursor into another but will make it readonly
or
SELECT * FROM cursor1 INTO CURSOR cursor2 READWRITE && query one cursor into another (VFP 8.0)
or
SELECT cursor1
COPY TO temp && copy to dbf
SELECT cursor2
APPEND FROM temp && append from dbf
DELETE FILE temp.dbf