Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to pass a variable to SQL statement.
Message
From
01/02/2008 07:55:29
 
 
To
01/02/2008 07:10:59
Mike Yearwood
Toronto, Ontario, Canada
General information
Forum:
Visual FoxPro
Category:
Troubleshooting
Miscellaneous
Thread ID:
01287831
Message ID:
01287891
Views:
13
>>>Hello all. Another noob question.
>>>I have 2 fields. One is a text box, the other a combo box.
>>>The LOST FOCUS property of the text box assigns its value to a xVariable
>>>Then it populates (or tries to)the combo box with:
>>>thisform.combo1.rowsource="select names from table1 where names LIKE xVariable into cursor Z"
>>>In other words, I want that if xVariable is "GA", the combo box is populated with all the names that start with GA.
>>>I have tried several posibilities with no success. What am I missing?
>>>
>>>TIA
>>how about:
>>
>>thisform.combo1.rowsource="select names from table1 where names LIKE " + xVariable + " into cursor Z"
>>
>>However this will not work unless xVariable is public. Better to make it a Form Property:
>>
>>
>>thisform.combo1.rowsource="select names from table1 where names LIKE "+ ThisForm.xVariable + " into cursor Z"
>
>Umm. Hello? Does anyone worry about SQL Injection Attacks anymore?

I don't know.Do they?

Anyway this is not the approach I would take if I were to write the application. I just never use a select statement as a rowsource. This is just a suggestion for something to try, as the post indicated.

Besides it depends on what you are planning to prevent injection into. In a normal ADD/EDIT form with multiple fields I doubt anyone developer would place any SQL Injection prevention code in every field anyway. Especially if there are many fields on the form, into anyone of which code could be injected anyway.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform