Shouldn't I be able to reuse an object? My results are always the same.
(The QueryClass connects to a database and returns the result as a
String.)
Here's an example:
QueryClass queryObj = new QueryClass();
String queryObjString_1 = queryObj.QueryClass("select id from user").toString();
String queryObjString_2 = queryObj.QueryClass("select name from user").toString();
Here are the incorrect results (they should not be the same):
queryObjString_1 = 52145
queryObjString_2 = 52145
--------------------------------------
However, it works when I do this:
QueryClass queryObj_1 = new QueryClass();
String queryObjString_1 = queryObj_1.QueryClass("select id from user").toString();
QueryClass queryObj_2 = new QueryClass();
String queryObjString_2 = queryObj_2.QueryClass("select name from user").toString();
Here are the correct results:
queryObjString_1 = 52145
queryObjString_2 = Dave
Any help would be greatly appreciated.