| Author |
Resultset Problem
|
Raosaheb Patil
Greenhorn
Joined: Jan 07, 2004
Posts: 6
|
|
Please check the following Code. Am I missing something? It gives runtime error with "result.getInt("FY")".But if we substitute the real Values it works fine... SelStmt= "Select t1.* " + "from program t1, quarter t2 " + "where (t1.fy=t2.fy and t1.quarter= t2.quarter) and activity_grp_code='PA'"; stmt = con.prepareStatement(SelStmt); bFlag = stmt.execute(); result = stmt.getResultSet(); max = stmt.getMaxRows(); String Seltmpsql; ResultSet SeltmpResult; boolean tmpFlag; PreparedStatement Seltmpstmt = null; Seltmpsql="Select sdate,edate from quarter " +"Where" + result.getInt("FY");
|
 |
Joe Ess
Bartender
Joined: Oct 29, 2001
Posts: 8265
|
|
It would really help if you would print the message and the stack trace of the exception you are getting. I can take a wild stab at it and point you to the documentation for java.sql.ResultSet:
A ResultSet object maintains a cursor pointing to its current row of data. Initially the cursor is positioned before the first row. The next method moves the cursor to the next row, and because it returns false when there are no more rows in the ResultSet object, it can be used in a while loop to iterate through the result set.
|
"blabbing like a narcissistic fool with a superiority complex" ~ N.A.
[How To Ask Questions On JavaRanch]
|
 |
Jason Steele
Ranch Hand
Joined: Apr 25, 2003
Posts: 100
|
|
You have a syntax error in your sql statement:
Seltmpsql="Select sdate,edate from quarter " +"Where" + result.getInt("FY");
Your WHERE clause is missing a comparator. I think you want: Seltmpsql="SELECT sdate,edate FROM quarter WHERE fy = " + result.getInt("fy"); Good Luck!
|
An egg is a chicken's house!
|
 |
 |
|
|
subject: Resultset Problem
|
|
|