The first example opens a table named VACATION.DBF:

q= new Query()

q.sql = "select * from VACATION"

q.active = true

The second example opens a table named REQS in a database named PERSONNEL in a new session with a preset user name and password:

s1 = new Session()

d1 = new Database()

d1.databaseName = "PERSONNEL"

d1.session = s1

d1.loginString = "visitor/jobsavail"

d1.active = true

q1 = new Query()

q1.session = s1

q1.database = d1

q1.sql = "select * from REQS"

q1.active = true

The third example uses an SQL statement with parameters. Note that the parameter name is case-sensitive; the name in the params array must match the name in the SQL statement:

q1 = new Query()

q1.sql = "select * from CUSTOMER where STATE = :state"

q1.params[ "state" ] = "VA"

q1.active = true