Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Does Requery() affect _TALLY?
Message
De
27/07/2001 08:43:54
Alexandre Palma
Harms Software, Inc.
Alverca, Portugal
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00535351
Message ID:
00536309
Vues:
10
I'm glad that you like it.
>Hi!
>
>Nice tip.
>
>>Vlad,
>>for that matter if you really want to now how many records your remote view has or can have you can do the following code
>>
>>LOCAL lnreccount, lcsql
>>IF CURSORGETPROP('FetchAsNeeded', 'myview')
>> lcsql = CURSORGETPROP('SQL', 'myview')
>> lcsql = SUBSTR(lcsql, ATC(' FROM', lcsql))
>> lcsql = "SELECT COUNT(*) AS nreccount" + lcsql
>> sqlexec(myhandle, lcsql, 'mycursor')
>> lnreccount = mycursor.nreccount
>> use in mycursor
>>ELSE
>> lnreccount = RECCOUNT('myview')
>>ENDIF
>>if requery('MyView')=1 AND lnreccount>0
>>....
>>
>>this code can be place in an object that returns the lnreccount.
>>
>>
>>>Hi!
>>>
>>
>>>To see if any record is returned in the RV, you can also just check the eof() state of the view. If there are no records in returned rcord set, eof() returns .T. Wel, if you really want to know number of records, use of RecCount() is not avoidable. Its depended on what you want to do.
>>>
>>>HTH.
>>>
>>>>Hi vlad the poblem with this code is that if your remote view is fetch as needed
>>>>then all the records will be fetched by the reccount(). For large tables this will be a problem.
>>>>
>>>>>Hi!
>>>>>
>>>>>_Tally will not be set for remote views. Thus it is not recommended to use _Tally for views when you plan to move to SQl Server or other database in the future. You can use following:
>>>>>
>>>>>if requery('MyView')=1 AND reccount('MyView')>0
>>>>>...
>>>>>endif
>>>>>
>>>>>
>>>>>
>>>>>>Hello,
>>>>>>
>>>>>>1.) When I perform a requery() on an SQL-View from the command window then _tally is updated.
>>>>>>2.) If I perform a requery() from inside an EXE I seem to (sometimes) run code that is unexpected based on the _tally value.
>>>>>>3.) The Hacker's Guide doesn't list requery() as one of the items that affects _tally.
>>>>>>
>>>>>>I guess I should switch to reccount() to determine if requery() returns and records from a view.
>>>>>>
>>>>>>Thanks,
>>>>>>
>>>>>>Kevin
Alexandre Palma
Senior Application Architect
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform