Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
About SQL syntax and compiling (URGENT)
Message
From
21/01/2001 19:23:07
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00466414
Message ID:
00466417
Views:
12
Hello, Kosta,

You can try the following:

1. First of all, you'll need a method to validate the strings, because the user doesn't select anything in one combo, the resulting command will be something like and this will blow up the sql command.
So: create a custom method in the form (menu Form, New Method), named MyMethod or something.

The code in the method:
LPARAMETERS condition,value
IF value == '' OR value = 'ALL'
    sqlstring = ''
ELSE
    sqltring = 'AND ' + condition + ' = ' + value
ENDIF
RETURN sqlstring
The 'Save' button in the form (or Search or how do you name it) should have something like that in the Click's event:
sqlcommand = 'SELECT * FROM mydata WHERE ' + ;
    Thisform.MyMethod('mydata.scholltype',Thisform.Combo1.Value) + ;
    Thisform.MyMethod('mydata.city',Thisform.Combo1.Value) + ;
........... and so on, until they're finished ............
    'INTO Cursor MyResult NOFILTER'
2. Somewhere in the beginning of the main program place the line
_screen.WindowState = 2
Hope this helps.
Grigore Dolghin
Class Software.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform