Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
DataSession and Queries ran from an object???/
Message
From
10/06/2014 15:50:19
 
 
To
10/06/2014 12:44:35
General information
Forum:
Visual FoxPro
Category:
Object Oriented Programming
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows Server 2012
Network:
Windows 2008 Server
Database:
Visual FoxPro
Application:
Web
Miscellaneous
Thread ID:
01601560
Message ID:
01601601
Views:
45
Interesting. The .AddObject( ) method is not documented in the standard VFP9 help but it is at http://msdn.microsoft.com/en-us/library/cszcy2ac%28v=vs.80%29.aspx .

It looks to me like .AddObject( ) when used with a VFP class, creates a new instance of the class. So, this would not give him any reference to the previous instance on Form A (?)

>(update to my previous answer)
>
>It makes a difference whether the object is 'added' to the form using addObject() - becoming a form member - or addProperty():
>- using addObject() makes the object participate in the form's dataSession
>- using addProperty() keeps the object independent from the form's dataSession
>
>>Here's what I'm finding...
>>
>>Any object in FoxPro that runs a query, whether against native DBFs or Sql Server, will create the cursor in the DataSession which was active at the time the object was created.
>>
>>The means that if you have a BO created in Form A with a Private DataSession, and you pass that object to Form B which has its own Private DataSession, if you use the object to run a query from Form B, the cursor will be created in the DataSession from Form A.
>>
>>Crazy! But true. It took be about an hour of stepping through the codez to figure this out.
>>
>>Does anyone know a work around, or a pattern to avoid this??
>>
>>
>>.
Regards. Al

"Violence is the last refuge of the incompetent." -- Isaac Asimov
"Never let your sense of morals prevent you from doing what is right." -- Isaac Asimov

Neither a despot, nor a doormat, be

Every app wants to be a database app when it grows up
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform