Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SQL Select from table in different data session
Message
From
26/08/1998 11:50:47
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00130093
Message ID:
00130115
Views:
19
>>>I have a form (lets say form1) that creates a temporary cursor from 3 source tables. Then I have another another form (form2) that needs to see that temporary cursor but not see the three source tables. So if I setup form1 to have a separate data session to hide the source tables, how can I get form2 to see that temp cursor created by form1? Changing how my data sessions are setup is an option if necessary. Any ideas? TIA!
>
>>OIC.
lnId = thisform.datasessionId  && Save sess id
>>set datasession to form2.datasessionId  && Change data session
>>* Utilize cursor
>>set datasession to lnId && Restore session
Cetin
>
>So ok, that gives me access to the cursor, but does not help solve my problem. I need form2 to actually *see* the temp cursor because it needs to run other queries in it's own data session that use the temp cursor created by form1 as a data source. I guess this defeats the purpose of private data sessions and therefore I can not do it?
Roxanne,
You could do it :) I've found two ways.
1)
* Form2 prepares cursor
open database mydbc
create sql view myview ;
 as select * from mytable
* Form2 destroys the view in release
drop view myview
 
* Form1 accesses
open  database mydbc
use mydbc!myview in 0 alias test
select test
browse
2)* Form2 selects SQL into cursor mycursor
* Form1 gets a copy
lnId = thisform.datasessionId
set datasession to form2.datasessionId
cDBF = dbf("mycursor")
set datasession to lnId
use (cDbf) in 0 alias myCopyCetin
Ç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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform