Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
This a bug or a limitation - select qry not discriminati
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00856410
Message ID:
00856900
Vues:
19
>Tamar:
>Having read your columns, ideas and advice in FoxPro Advisor and elsewhere for many years, I'm delighted by your interest in helping resolve this issue. You do a great job and provide a great service to us all in the community. I'm also somewhat embarrased having discovered the problem but it was your suggestion that brought the solution back to my awareness. Just one of the things I love about VFP is that it is so powerful, versatile and forgiving but often has quirks that can catch you short and leave you scratching your head. This is one such case. <g>
>
>To Wayne and Trey: My grateful thnx also to you both for your respective offers of ideas towards resolving this perplexing issue.
>
>Here is the answer and I accept 10 lashes of a wet noodle for missing it: I hope you forgive me for taking up your valuable time.
>
>My table and view all have columns labeled "pat_id", "mom_id", "hosp_id". By (inadvertently) naming my parameters with the exact same labels as the source data columns (which you wouldn't have known since I had not included that info in my original post here), the query becomes ambiguous ~ As you know, VFP, in such a select statement, cannot discriminate amongst the source column values even when based upon specific parameter values when those query values are held in vars labeled with the exact same name as the columns being interrogated: This is because implicitly every column in the table that is directly related to any one of the respective query vars (parameters) by same-name therefore contains every value implied in the query by virtue of the fact of the parameter's name equals that very same column name that the query is testing.
>
>On the other hand, by simply relabeling the parameters to "lpat_id", "lmom_id", "lhosp_id" respectively so that they are now differently named compared to the source data columns under query, then this query runs perfectly every time.
>
>
>lhosp_id = '+ÙF€ÞmÙF€ÞŠì'
>lmom_id = ',¢>Žt]¢>Žt‰õ'
>lpat_id = '001340RWZUB'
>
>SELECT bc.* FROM babychgview2 bc ;
> WHERE bc.pat_id = ?lpat_id and bc.hosp_id == ?lhosp_id
>
>Funny how it's so easy yet so invisible, wouldn't you agree? Thnx. again for your help. /psb

Sounds like another example of a good reason to use M. to prefix variables and alias. to prefix fields to prevent ambiguity if there is the potential to have same named fields and variables.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform