Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Indexing error confusing
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00129676
Message ID:
00129990
Vues:
24
>>Sawadee,
>>
>>I have a form that takes 2 parameters for the purpose of specifying a field and a value for an SQL statement that loads a grid.
>>
>>parameters pcTom, pcJerry
>>local lcdate
>>
>>lcDate = date()
>>thisform.grid1.RecordSource = ''
>>select * from mytable;
>>where &pcTom = &pcJerry;
>>and tdate = lcDate;
>>order by &pcTom into cursor cCursorUniq
>>thisform.grid1.RecordSource = cCursorUniq
>>
>>If pcTom is a regular index, the select statement generates an error 'Cannot find variable pcTom'. If pcTom is not an index at all, the select statement does not err but, when I click the header(my code) for that field to set order to pcTom in the grid, it produces the error 'table has no index order set', as it should. Why does the select statement complain that it can't find pcTom if it is a regular index in mytable, then not complain when pcTom is not indexed? There must be something obvious I'm missing.
>>
>>TIA,
>>
>>Eric K.
>
>When you issue something like
>SELECT .... From Table1 Where &pcTom.=....
>and pcTom contains literal table1.field name then SELECT will work, but if you pass something which is not field name then, firstly VFP thinks that this is variable and generates the message you received, because there is not such a variable. Basically, you should always pass literal field name.


The code works when the field contained in pcTom(literal name) is not indexed. Select is having a problem with the indexing rather than the syntax. I think.

Eric K.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform