Using the SQL Genie
Description
The SQL Genie helps you write SQL expressions. This page contains some pointers on how to use it.
The SQL Genie helps you write SQL expressions. To start the SQL Genie:
Create a SQL::Connection object and open a connection to AlphaSports.mdb.
Pass the SQL::Connection object to the SQL_Query_Builder() function.
dim qry as C dim conn as SQL::Connection conn.open("{A5API=Access,FileName='C:\Program Files\a5v8\MDBFiles\Alphasports.mdb',UserName='Admin'}") qry = sql_query_builder(conn)
This opens the SQL Genie and displays its Tables tab.Click Add Table to display the Add Table dialog.
Select "Customer" and click OK. When you return to the SQL Genie, you will see the start of your SQL expression in the SQL window.
Display the Columns tab.
Select the "FIRSTNAME", "LASTNAME", "PHONE", and "FAX" entries in the Available Columns list and click the 'right arrow' icon to move them into the Selected Columns list. Note how the SELECT statement in the SQL window updates to reflect your latest choices.
Display the Filter tab.
Click the 'up arrow' icon to display the Select Column or Expression dialog.
Select "PHONE" in the Columns list and click OK. Note how the SELECT statement in the SQL window updates to reflect your latest choices.
Click the 'down arrow' icon to display the Operator list.
Select "is not null".
Display the Order tab.
Select "LASTNAME" in the Available Columns list and click the 'right arrow' icon.
Select "FIRSTNAME" in the Available Columns list and click the 'right arrow' icon . Note how the SQL window displays the latest version of the SQL SELECT statement.
Click OK to return to the Interactive window.
Execute the query and list the data you get back. The data contains 4 fields, filtered, and ordered as you specified.
conn.execute(qry) dim data as C data = conn.resultset.ToString() ? data = Winston Abrams (402) 555-6112 Randi Adams (808) 555-6721 (808) 555-7500 John Baker (914) 555-8400 Tom Barber (914) 555-8700 Jeffrey Bernstein (914) 555-0987 George Boschetti (803) 555-6143 ...
Close the connection.
conn.close()
See Also