Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Custom object data session?
Message
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Programmation Orientée Object
Divers
Thread ID:
00710978
Message ID:
00711023
Vues:
13
Ok, I see. You can add a new method to your object SwitchDS. This method will save current DS and set DS to passed DS. In form's destroy you will call RestoreDS() method of this object.

How about this idea?

>The thing is that I wasn't _instansiating_ the object from the form at all. I was just calling it from there. It's a global object. That's what the problem was. But making it a local object makes it useless, so my only option is to give up on trying this n-tier thingy and going back to just talking to the data directly.
>
>Thanks,
>
>Michelle
>
>---------------------------------------------------------------------------------
>
>>Hi Michelle,
>>
>>I know, if I instantiate an object in the Init of the form, it inherites form's DS. Perhaps, Form's Load is too early...
>>
>>Anyway, try to pass form's DS to the object. E.g.
>>
>>myObject = newobject('myClass', 'myClassLib.vcx',,thisform.DataSessionID)
>>
>>Object's Init
>>lparameter tnDSID
>>if vartype(m.tnDSID)="N"
>>   set datasession to m.tnDSID
>>endif
>
>----------------------------------------------------------------------------------------
>>
>>>That won't work since I'm calling the object's method in the load. Otherwise I'd be using the object before instantiating it. :)
>>>
>>>Thanks,
>>>
>>>Michelle
>>>
>>>Sigh... I see HR was taken away. I guess I'll hand draw the lines...
>>>
>>>------------------------------------------------------------------------------------
>>>
>>>>Try to instantiate your object in the form's Init...
>>>
>>>------------------------------------------------------------------------------------
>>>
>>>>>Maybe I'm not being clear...
>>>>>
>>>>>The form is using a private data session. In the load of the form, I call this custom object to gather some data. When the object's code runs, it errors because it can't find the cursor I told it to put the data in (which was created in the form). If I suspend, I can see that I'm in the default data session, and not the form's private data session. I need the object to use the same datasession as the form that is calling it, _not_ the default datasession. How do I do that?
>>>>>
>>>>>Thanks,
>>>>>
>>>>>Michelle
If it's not broken, fix it until it is.


My Blog
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform