Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SQL Select MS Bug
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00361940
Message ID:
00361949
Vues:
16
No this isn't a bug, it's actually by design. Before VFP actually runs the SQL select, it parses it to determine the structure of the output. In order to do so, it calls your function incrementing lncount. Then when the select is actually run, lncount is off by a factor of 1. I would just initialize lncount to lncount = 0 - increment value, in this case 1.

HTH.

>Is this me or an MS bug The following program should return a cursor with 1,1 and 2,2 as the first and second record, it returns 1,2 and 2,3
>
>The function GetRec() is executed 3 times !!!??? and should be executed only twice as th tmp table has only two records.
>
>Anyone ever experienced this before ?
>
>Thanks.
>
>
>
>**- TestSql.Prg
>CREATE Cursor Tmp ( nRec N(1) )
>INSERT INTO Tmp (nRec) Values (1)
>INSERT INTO Tmp (nRec) Values (2)
>
>Copy To Tmp.Dbf
>USE
>
>lnCount = 0
>
>SELECT nRec, GetRec() AS nRecno From Tmp.dbf INTO Cursor TestBug
>Browse
>
>FUNCTION GetRec
> lnCount = lnCount + 1
> RETURN lnCount
>ENDFUNC
Larry Miller
MCSD
LWMiller3@verizon.net

Accumulate learning by study, understand what you learn by questioning. -- Mingjiao
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform