Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Passing datasession or SET('DATABASE') to other form
Message
 
À
15/02/1999 17:56:28
Eric Barnett
Barnett Solutions Group, Inc
Sonoma, Californie, États-Unis
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00187750
Message ID:
00188005
Vues:
23
You found it. I put a SET DATABASE TO mydatabase in the calling form. The dbGetProp command in the search form started working. I will put code in my framework that checks THISFORM.DataSession, and if it = 2 - private, it will get the database name from one of the cursors in the dataenvironment and SET DATABASE TO that. If I ever need to have more than one database open in a single form, I'll figure something else out, but I don't expect that to happen.

I find it odd that my old Search form, called from that same form with private data session, could use AFIELDS() to get all the fields, LOCATE to move the pointer, and GOTO savedrecord if it didn't find a record, all without worrying about SET DATABASE. Furthermore, the calling form could use FOUND() and CONTINUE to search for the next record. It was only when I needed dbGetProp in the search form that I had problems. Oh, well. Thanks, everybody.

>Unless I'm not understanding this either, you're using something like DBGETPROP to get captions from the database. Tables can be opened (in the DE or elsewhere) without their database being the active one. You seem to have to choices:
>
>SET DATABASE TO (mydatabase) before running the form, or
>
>pass the database name to the form, a la DO FORM (myform) WITH (mydatabasename)
>
>Then in the Init of the form,
>
>LPARAMETERS cDataBase
>SET DATABASE TO &cDatabase
>
>Assuming of course that the database is at least open.
>
>Is this your question?
>
>>That was quick.
>>
>>I'm still stumped, but I'll re-iterate the clues: the error indicates that I need to SET DATABASE TO something. However, in the calling form, the DBC() function returns an empty string, so I can't pass the name of the database to the search class. I should also mention that I am using vfp6 and that my forms were converted from vfp3.
>>
>>My short-term stop-gap measure is to disable the code that gets caption names when the calling form has a private datasession. But I don't want to leave it like that.
>>
>>>Sorry, Bret.
>>>
>>>I meant set the form property called that is called DataSession to 1)-Default Data Session. Which apparently you have done.
>>>
>>>Then, if your private form calls the search form, the search form will use the datasession from the private form by default.
>>>
>>>If you are not seeing it...then there is something else wrong. (At least as far as I can tell.)
>>>
>>>>I'm not sure what you mean by "set the default datasession to default". The .DataSession property of my search form class is 1 - default.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform