Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
CursorAdapter and WHERE
Message
De
05/06/2008 12:24:53
Scott Malinowski
Arizona Fox Software LLC
Arizona, États-Unis
 
 
À
21/02/2008 14:56:24
Information générale
Forum:
Visual FoxPro
Catégorie:
Classes - VCX
Divers
Thread ID:
01294821
Message ID:
01321893
Vues:
35
Borislav,

Thank you for the insight into cursor adapter select command issues. This post was EXTREMELY helpful for me in understanding how this all works. I appreciate it!

Now, I have another issue that I am posting to you since you seem to understand a lot about this topic.

What if I have a search form that is used for selecting data based on several optional parameters? THis would require a dynamic, changing select statement that can vary a lot between CursorFill() executions.

Here's some examples of the queries that I need to be able to run on a single cursor adapter:
1. Base command: 
Select lastname from People ;
    INNER JOIN statushistory on people.peostcfk = statushistory.sthid ;
    where people.peoschfk = ?nschfk 

2. Command with multiple paramaters added: 
Select lastname from People ;
    INNER JOIN statushistory on people.peostcfk = statushistory.sthid ;
    where people.peoschfk = ?nschfk ;
        and poeple.peolastname >= ?cStartLast ;
        amd people.peolastname <= ?cEndLast

3. Command with different parameters added:
Select lastname from People ;
    INNER JOIN statushistory on people.peostcfk = statushistory.sthid ;
    where people.peoschfk = ?nschfk ;
        and people.peossn = ?nssn 
You can see that the select statement varies significantly from one execution to another. Do you have any suggestions or tips for me on how to manage this in my application?

Thanks in advance!

Scott



>The right place to build WHERE clause is in BeforCursorFill method. BUT DO NOT Change SelectCmd, only change cSelectCmd parameter value.
>Better DO NOT CHANGE anything just use Parameters:
>
>this.SelectCmd = [SELECT * FROM YourTable WHERE SomeField = ?lePar1 AND OtherField = ?lePar2]
>
>*** Then:
>lePar1 = 1000
>lePar2 = [BlahBlah]
>oCA.CursorFill()
>BROWSE NORMAL
>lePar1 = 2000
>lePar2 = [BlahBlah 800]
>oCA.CursorRefresh()
>
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform