Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Building a complex query
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Versions des environnements
Visual FoxPro:
VFP 6
OS:
Windows 2000 SP4
Network:
Windows 2000 Pro
Database:
Visual FoxPro
Divers
Thread ID:
00980679
Message ID:
00980698
Vues:
61
Ok
Then something like that:
cWhere = ""
lAnd = .f.
  IF .NOT. EMPTY(thisform.Text1.Value)
     cWhere  = "MyTable.MyField == "+TRANSFORM(thisform.Text1.Value) && for Numeric Fields
*     cWhere = "MyTable.MyField == '"+TRANSFORM(thisform.Text1.Value)+"'" && for Char Fields
*     cWhere = "DTOS(MyTable.MyField) == '"+DTOS(thisform.Text1.Value)+"'" && for Date Fields
      lAnd   = .t.
  ENDIF

  IF .NOT. EMPTY(thisform.Text2.Value)
     cWhere = IIF(lAnd," AND ","")  + "MyTable.MyField == "+TRANSFORM(thisform.Text2.Value) && for Numeric Fields
      lAnd   = .t.
  ENDIF

 ....
cWhere = IIF(EMPTY(cWhere),".t.", cWhere)

SELECT .... FROM .... WHERE &cWhere INTO ...
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform