![]() ![]() ![]() |
JBuilder Advanced Database Concepts: Query Notes
QueryDataSet q = pqDM1.getDataModule(); ... load parameters .... q.open() q.executeQuery(); ... checking results ... q.close(); }catch (Exception x){ System.err.println(x); } The above query will ensure that each time the query is executed, the new parameters are in place. If you don't have the executeQuery() method, the result set will not get reset upon re-entrance to this method. Also, if you only have the open() method the first time you run the query it will work, however subsequent runs will fail. Since this technique closes the QueryDataSet at the end of the process, you must call the open() method upon re-entrance of the query. Another way to do the query is as follows:
QueryDataSet q = pqDM1.getDataModule(); ... load parameters .... q.open() q.refresh(); ... checking results ... q.close(); }catch (Exception x){ System.err.println(x); } The same rules apply as above. The JBuilder help seems to like the refresh() method over the executeQuery() method. I have found no difference in the methods.
|