Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Sub query with Ado RecordSet
Message
De
13/02/2001 19:55:28
 
 
À
13/02/2001 19:49:22
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00475498
Message ID:
00475536
Vues:
36
OOPS!
Forgot MyRS.MoveNext in the Do While loop and the
quotes in MySql were wrong. This is the corrected code:
cValueList = ""
do while not MyRs.EOF
  cValueList = cValueList + MyRS.Fields("<field_name_here>").value + ","
  <b>MyRS.MoveNext</b> 
enddo

* strip the last comma and add quote
cValueList = left(cValueList, len(cValueList)-1)

* (you may need to enclose values in quotes, depending the column types being integers or strings)

MySql = "Select * From MyTable Where IdNo IN (" + cValueList + ")"
nResult = SqlExec(nHandle, MySql)
HTH


Alex Feldstein, MCP, Microsoft MVP
VFP Tips: English - Spanish
Website - Blog - Photo Gallery


"Once again, we come to the Holiday Season, a deeply religious time that each of us observes, in his own way, by going to the mall of his choice." -- Dave Barry
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform