Show/Hide Toolbars

Navigation: Advanced topics > Programming topics > Database API

ASPRunnerPro32x32     ASPRunnerPro manual

SQL variables in SQL and Lookup wizards

Scroll Prev Next More

This feature can be used anywhere where you use SQL Queries. With SQL variables you can write cleaner code and easily implement custom dropdown boxes or advanced security. SQL variables are case-insensitive.

Where to use it:


In regular SQL queries that you enter on “SQL Query” screen 


In WHERE Tabs on “SQL Query” screen


In Lookup Wizard WHERE clause. It can be used in dropdowns that are dependent on any type of field, dependent on master dropdown, dependent with more complex rule than equality (i.e. age is more than selected).


WHERE CustomerID= ':user.CustomerID'
WHERE CustomerID= ':session.UserID'


In events by using prepareSQL function. For example, in  “After Add” event you can use:


sql = DB_prepareSQL("insert into log set")
DB_Exec( sql );


In button’s Server code or in field events for View/Edit pages:


sql = DB_prepareSQL("insert into log set lastname=':name'")
DB_Exec( sql );


A full list of SQL variables:

:field - current field value on Add, Edit or Register page  

:master.field - any field from master record  

:session.key - any session variable  

:user.field - any field from login table  

:old.field - old field value (before any changes were applied)  

:new.field - new field value.



See also

Lookup wizards