| AppliBuilder
User Documentation |
This example shows how to use a aNamed Query, and display the query results. First add a few named queries (without parameters).
Run the page preview, and try the named queries you setup.
The doQuery function is used to execute the code. Add this function using the Add Function item in Function menu.
var qname = 'show pages';
var tfield = getWidgetByName('Textbox2');
if (tfield) qname = tfield.value;
/* Get Ajax Client. */
var ajaxdb = new Applibase.db.AjaxDb();
/* Do a sql query, asynchronous with callback handler. */
ajaxdb.query(qname, null, true, callback);
/* Callback handler will be passed with resultSet and error.
* If resultSet is null you will have to look at the error message.
*/
function callback(resultSet, error) {
if(resultSet == null) {
alert(error + " Response Status: " + ajaxdb.status());
} else {
ajaxdb.renderResultTable(resultSet);
}
}
| ©
2006 Applibase, Inc. |