Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Getting data from another datasession
Message
From
16/10/2001 12:52:20
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00569060
Message ID:
00569121
Views:
22
>If I use the set datasession to command then the select from my temporary cursor in the default datasession will also be placed in the default datasession then when my form again gains focus the datasession will change back to the form's datasession and neither of the cursors will be visible to the form.

Sorry I wasn't very clear. You just switch there to get data into something like an array, directly to lookup listbox etc (dbf('cursor') is likely to fail) and return to your own session. Here is a sample assuming a lookup wouldn't have more than 65000 elements :

* SQL server querying routine returned data to 'myCursor' which is in default datasession
* Form has private datasession
*Form.Load
lnsession=set('datasession')
set datasession to 1
select myCursor
afields(aStruc)
copy to array arrTemp
set datasession to lnSession
create cursor crsList from array aStruc
append from array arrTemp

*A listbox uses crsList as rowsource
*List.init
with this
 .RowSourceType=6
 .RowSource = 'crsList'
 .Columncount=3 && We only want to see first 3 cols
 .ColumnWidths='50,300,50'
endwith
Cetin
Ç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
Reply
Map
View

Click here to load this message in the networking platform