Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Looping -current value of ResultSet for new sqlQuery

Status
Not open for further replies.

vjh

Technical User
Dec 14, 2002
46
CA
Hello all,

I'm attempting to use the current value of a resultSet as a parameter in a separate query, and can't figure out how to do it! What I'm doing is obviously wrong - so I'd appreciate being set in the right direction...

-vj

Here's what I'm attempting (shortened and edited for readability, so there may be syntax things that don't work):

while(myResultSet.next()) {
myResultSet.getObject("name").toString();

if { something that works fine, no need to look further }

else {

currValue = myResultSet.getObject("mnemonic").toString();

myResultSet2 = sqlStatement2.executeQuery;
("SELECT name, description " +
"FROM types INNER JOIN codes" +
"ON types.code = codes.code " +
"WHERE mnemonic='" +
currValue + "'";

}
}

etcetera.

I get asssorted compile errors including not an expression statement, illegal start of expression, malformed expression, and variable executeQuery not found in interface
 
ResultSet Statement.executeQuery( String);

does not match this:

myResultSet2 = sqlStatement2.executeQuery;

You should learn to read and understand the compiler errors. Fixing these errors using a message based forum approach will be extremely SLOW.


-pete
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top