Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
About SQL syntax and compiling (URGENT)
Message
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00466414
Message ID:
00466429
Views:
9
>1- for example I have 5-6 criteria on the form and all of criteria comes with combobox and combobox contains related records their dbf's (combo1=scholltype,combo2=city,combo3=sex etc...) when I want to select from combo1 for 'highscholl',from combo2 'texas', for combo3 ALL (both of two sexuality) how should I write the SQL syntax ( e.g "select * from mydata where mydata.scholltype=thisform.combo1.value;
>and mydata.city=thisform.combo2.value;
>and mydata.sex=thisform.combo3.value; && how ??? (value must be male+female)
>into cursor myresult nofilter

Create variables to store the combo values. Build your SQL string then execute it:
lcScholl = ThisForm.Combo1.DisplayValue [or .Value]
lcCity = ThisForm.Combo2.DisplayValue
lcSex = ThisForm.Combo3.DisplayValue

lcString = "mydata.scholltype = '" + lcScholl + "' and "
lcString = lcString + "mydata.city = '" + lcCity + "'"
if lcSex <> 'ALL'
   lcString = lcString + " and mydata.sex = '" + lcSex + "'"
endif
select * from mydata where &lcString
Mark McCasland
Midlothian, TX USA
Previous
Reply
Map
View

Click here to load this message in the networking platform