Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Cursor problem
Message
De
10/06/1998 05:05:49
Mark Hall
Independent Developer & Voip Specialist
Keston, Kent, Royaume Uni
 
 
À
10/06/1998 04:34:36
David Moreau
Iglesia Ni Cristo - Dnm
Quezon, Philippines
Information générale
Forum:
Visual FoxPro
Catégorie:
Client/serveur
Titre:
Divers
Thread ID:
00106614
Message ID:
00106621
Vues:
29
>I created a means for my objects to request cursor names so that there would be no collisions among hardcoded cursor names, particularly when I use the same class twice in a form, yet the 2 classes retrieve different data from the back end.
>
>I am confused about how I can get to the data in the cursor. Normally, the cursor "cursor" would be created here:
>
>SQLEXEC(handle, sql_statement, "cursor")
>
>and I could use the data in the cursor through:
>
>some_text_edit.value = cursor.field1
>
>I am confused about what to do when the name can not be hard-coded, such as in my case of computer generated cursor names. In my case, there is a function REQUESTNAME(name_stem) that will give an unused cursor name. My code is something like this:
>
>
>curs_name = requestName("name_stem")
>SQLEXEC(handle, sqlQuery, curs_name)
>
>some_text_box.value = ????????????
>
>
>There is my problem. How do the value from a column into the textbox.
>
>I am also curious - what are the common techniques to keep an object from clobbering the cursor of another object of the same class? My solution was my first instinct, but I expect that there are other, better solutions.

Hi,
What you are doing is OK, we use a similar slice of code, but we have a data object that deals with the actual object - cursor interaction. The interface only has to talk to the data object, removing it one (or more) step(s) from tha actual cursor.

So, (in a simplified example) we might have
Some_Text_Box.Value = THISFORM.DataBroker.GetValue("Some_Field")

Each interface would have it's own data broker object. The data broker creates its own (unique) cursor to hold data from the appropriate table(s). Similarly we have a method for generating unique cursor names and, to answer your main question, you would use the Evaluate function, so

lcFieldValue = EVALUATE( lcCursName + ".FieldName")
Regards
Mark

Microsoft VFP MCP
Menulib - OO Menus for VFP www.hidb.com/menulib
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform