contents   index   previous   next

SimpleDataset find() with clause




whereClause - A string containing the WHERE clause of an SQL statement (without the word WHERE) indicating which items to find.



Boolean value indicating success. In the case that the operation failed, use the getLastErrorCode() and getLastError() methods to determine the reason for the failure.



This method searches the database table of a SimpleDataset for all items that match the given SQL WHERE clause. The contents of the SimpleDataset are changed to reflect the results of the search. The previous contents of the SimpleDataset are cleared and the complete database table is searched to create the new contents.


After the find has completed, the current record is set to the record "before" the first record.


The string passed into find contains a SQL WHERE clause. This allows more elaborate searches to be performed.



#include <smdtset.jsh>, SimpleDataset findAll(), SimpleDataset findDistinct()



// the following function will print out the fields

// of each of the records that have either Boston

// or Paris as their city values

function print_BostonParis(db, table, user, passwd)


   // create the SimpleDataset

   var ds = new SimpleDataset(db, table, user,



   var whereClause;


   whereClause = "(City = \'Boston\') OR 

                  (City = \'Paris\')";


   ds.find(template1, template2);


   while(var rec = ds.nextRecord())

      for(var prop in rec)

         Clib.printf(prop + " = " + rec[prop] +






SimpleDataset findAll()