Tech Tip: How to perform parameterized queries
PRODUCT: 4D Developer | VERSION: 11 | PLATFORM: Mac & Win
Published On: October 3, 2007
Your current browser may not allow you to download the asset. We recommend Mozilla Firefox or Google Chrome.
In order to pass a dynamic value to and from SQL, you need to encapsulate the variable name in either double greater than/less than symbols or precede it with a colon in SQL, for example:
The colon-notation represents a parameter to a Parameterized Query.
The bracket notation is called Direct Association.
Here are two examples:
|`Example: Move the results of a SQL query into a 4D List Box object, listbox1. |
SELECT * FROM Customers INTO <<listbox1>>
|`Example: Insert a value determined in 4D into a SQL statement: |
SELECT * FROM Customers WHERE Name = :vName