Information générale
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
>When you setup a view in the designer and give it a parameter to use in the criteria, how do you get ALL records? For example, I have a view with a parameter ?lcCategory which the majority of the time is set to one of many possible categories in the database. However, sometimes the user wants to see ALL categories (hence all records). I can't just make it blank, because it looks for a blank category, but none exist (categories are chosen from a lookup table). At first I thought this should be easy, and it probably is, but I'm not getting it!!! Any help would be appreciated.
I guess you are using SQL Server as backend because a local view in VFP will return all rows for an empty parameter. To obtain all the rows in your view replace your condition from
field=?lcCategory
to
field LIKE ?lcCategory
and set lcCategory to "%" before opening your view
HTH
Précédent
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement