Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Select query for dynamic search with if condition
Message
From
21/05/2004 15:21:34
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Other
Title:
Select query for dynamic search with if condition
Miscellaneous
Thread ID:
00906123
Message ID:
00906123
Views:
50
I am trying to create a select query to search the table (dynamic search)
if i fill the project and contract text boxes it should search with both criteria, if i dont fill project then it should ignore project and then search only with contract, if i fill only project then it should search only with project and ignore the contract if completely.
the following i use in VB with multiple fields.

I want to use the same style query in VFP.
Can you please help me create it.

******************
ssql = "select * from projects"


If combo1.Text <> "" Then
wsql = " where proj = thisform.combo1.value"
EndIf

If combo2.Text <> "" Then
If wsql <> "" Then
wsql = wsql + " and " + " contract = thisform.combo2.value"
Else
wsql = " where contract = thisform.combo2.value"
EndIf
EndIf

osql = " order by project_id into Cursor lcSource"

ssql = ssql + wsql + osql

&ssql

************************
Thank you very much in advance.
Next
Reply
Map
View

Click here to load this message in the networking platform