Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Populating a Combo with an SQL statement
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Divers
Thread ID:
00208027
Message ID:
00208375
Vues:
24
>I'm trying to populate a combo box with an sql command (RowSourceType=3)
>
>Here is what i'm putting in the RowSource:
>
>Select functions.function from functions where type="S" into cursor ComboString
>
>the combo always comes up empty!
>
>any ideas?
>
>
>thanks in advance for your sage advice!
>
>scott

There are a couple of ways you can go here. The problem you are having is because you are right in the middle of the two.

First you can use a(n) SQL clause to populate your combo. To do so,

Set RowSourceType = 3 (SQL - Statement)
Set RowSource = "SELECT this FROM that WHERE something = someotherthing ORDER BY theotherthing INTO CURSOR mycursor"

You do need the INTO CURSOR mycursor or it will fail.

As Ed said, you can then use the Combo.Requery() method to refresh your combo if the parameter changes.

Second you can fire your sql into a cursor and set the row source type to 1 (Alias)

Set RowSourceType = 1 (Alias)
Set RowSource = "mycursor" (Assuming the same SQL as above)

In which case you can re-fire the SQL to generate your cursor again. You will have to do the bindings again ...

I recommend the former method as it has never failed, and is nice and quick.

Regards,

Jason
Jason Tryon
Senior Systems Analyst / Technical Lead
eBusiness / iPage
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform