Testing a query

The query:

var maxReturedRows = 25;//usefull to limit number of rows
var query = ‘SELECT klant_id FROM klanten WHERE logonname ='’+ globals.gloginName +‘' AND logonpassword ='’+ globals.gloginPassword +‘'’ ;
var dataset = databaseManager.getDataSetByQuery(‘Ready2Learn’, query, null, maxReturedRows);

this works; now depending on wether the dataset is empty (null according to docs) I want to load a set of records or not

if(dataset)
{
forms.klanten.controller.loadRecords(dataset)
forms.klanten.controller.show()
}

This way I allways see the controller, so the if is always executed. Why is that since when I found no records dataset was null?

TIA

There is always a dataset returned (even if there was an error, in which case the error msg can be retrieved), to which point in the manual are you refering?

Performs custom SQL queries on a database; will return null if the dataset contains no rows; will display an error if the query syntax is incorrect.

Help navigator: getDataSetByQuery

HTH

Performs custom SQL queries on a database; will return null if the
dataset contains no rows; will display an error if the query syntax is
incorrect..

The description for the function databaseManager.getDataSetByQuery
has been corrected in the next version of the Servoy Developer Edition
Volume 2: Reference Guide as well as in the Servoy online Help Navigator
(F1 Help) and the corresponding pdf file.

The modified text for the getDataSetByQuery function will read:

Performs custom SQL queries on a database; returns an empty dataset
with a SQL database error message if the dataset contains no rows; will
display an error if the query syntax is incorrect.

NOTE: The function dataset.getExceptionMsg() can be used to retrieve a
SQL database error string. For detail on syntax and examples, see the
section below on SQL query functions.


Marc Norman
Servoy