Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Checking for existence of cursor
Message
De
29/05/1997 09:28:04
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00033839
Message ID:
00034019
Vues:
45
>>>>>What is the most efficient way to check for the existence of a cursor? I have two textboxes, into which the user types values from a table. I have two buttons. Click the first one and it does a SELECT ALL field1, field2... FROM mytable INTO CURSOR mycursor WHERE BETWEEN(field2, box1.value, box2.value). I want the second button to add the single value of box1 to the cursor, without replacing what's already in the cursor, which is what the SELECT...INTO CURSOR does. I figured that if I knew that the cursor was there, I could SELECT and then INSERT - SQL instead. The cursor is the rowsource for a listbox.
>>>>
>>>>Generally, the normal way to check Cursor existence, is USED() function.
>>>>IF USED("mycursor")=.T.
>>>> Select mycursor
>>>> INSERT ....
>>>>ENDIF
>>>
>>>Of course! Where is my head today? Thank you again.
>>
>>Whoops! Um...when I try to INSERT INTO mycursor FROM ARRAY myarray, it tells me that the cursor is readonly. I suppose that wouldn't happen if I CREATE CURSOR from the beginning, but what is the most efficient way to make the cursor not be readonly?
>
>Bret,
>
>INSERT INTO wants the dbf file name NOT the alias of the cursor. You can;
>
> SELECT
> lcFile = DBF()
> INSERT INTO (lcFile) ...

Sorry, that's not right. The reason of the error is SELECT statement which creates read-only cursors. If cursor will be created with CREATE CURSOR command the problem is gone.
Edward Pikman
Independent Consultant
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform