[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Resultset...



Thank you...I had just figured it out and was sending out an email saying -- Problem solved...
 
Thanks again for the reply(s)...
 
jags
----- Original Message -----
Sent: Monday, February 11, 2002 11:21 AM
Subject: RE: Resultset...

System.out.println(rs3.getString("\"" + caseNoName + "\"")); 
 
The extra quotes are not necessary. Change this line to:
 
System.out.println(rs3.getString(caseNoName)); 
 
and it should work.
-----Original Message-----
From: Jagdeep S. Bedi [mailto:jbedi@palasys.com]
Sent: Monday, February 11, 2002 10:54 AM
To: ajug-members@www.ajug.org
Subject: Resultset...

Hello all...
 
Scenario:
...
String selectCaseQuery = "Select * from " + dbTableName + " order by " + caseNoName;
Statement stmt = con.createStatement();
ResultSet rs = stmt.executeQuery();
...
 
My question is, when retrieving the resultset is it possible to specify a variable in the getString methods of Resultset:
For instance:
 
...
while(rs3.next()){
     System.out.println(rs3.getString("\"" + caseNoName + "\""));  //I have tried this but to no avail, is there a workaround!?
 }
...

I have tried the above statement but it dosen't seem to work and i know why.  But is there some workaround.  When I ask my users for a columnName of the database they intend to use, I must specify that name in the getString methods. 
Any and all help is greatly appreciated!
 
jags