Newbie question... :(

Hi Sry for maybe stupid question.. I have a sql ResultSet like this: ResultSet myResultSet = stmt.executeQuery(query); but I want to dynamically change the var name of ResultSet like:String res = myGeneratedResultSetname; ResultSet res = stmt.executeQuery(query); and thats shows error, cant convert string to resultset etc... So is it possible to change ResultSet's var name, or I have to write exactly ResultSet varname = stmt.executeQuery(query); I stuck on this problem, and already wasted about 3 hours trying to solve it..plz heeelp Best regards...

[This message has been edited by Ilja Smoli (edited December 21, 2001).]

As far as my knowledge goes this is not possible. Name of a variable should known by the compiler, i.e during compile time. What you are doing is generating a name during runtime and trying to create a variable in that name. However to accomplish what you are trying to do, you can use a collection of ResultSets, like a vector of Resultsets, etc. Ranchers, Correct me if I'm wrong Rex

Ilja Smoli

Ranch Hand

Posts: 64

posted 16 years ago

Ok, seems there is no way to do it, but I'll try to explain for what I tryed to do it. Im trying to generate block of code (sql queries), using do..while loop, and as u know there can't be statements or Resultsets with same names, so it needs to be generated... Ok maybe u could advise about generating code blocks using different way...and btw, about vectors, where can i get normal manual about it. Thx a lot... Best Regards, Ilja