Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Sub query with Ado RecordSet
Message
From
13/02/2001 19:55:28
 
 
To
13/02/2001 19:49:22
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00475498
Message ID:
00475536
Views:
40
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
Previous
Reply
Map
View

Click here to load this message in the networking platform