Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Invalid operation for forward only resultset : last

 
pankaj semwal
Ranch Hand
Posts: 303
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I am getting my resultset value 0.
For this its showing the following exception


Invalid operation for forward only resultset : last

Please help me to short out this problem.

This my Businss logic for EditValue

public void EditCountry(DemoForm dForm) {
String empId = dForm.getId();
System.out.println("Value of id"+empId);
try {

Class.forName("oracle.jdbc.driver.OracleDriver");
con = DriverManager
.getConnection("Jdbc:Oracle:thin:@localhost:1521:semwal",
"scott", "tiger");

ps = con.prepareStatement(SQL2);
ps.setString(1, empId);

rs = ps.executeQuery();
System.out.println("rs =="+rs.getRow());
int TotalRow = 0;
rs.last();
TotalRow = rs.getRow();
rs.beforeFirst();
if (TotalRow > 0) {
rs.next();
System.out.println("value of in rs"+rs.getString("ename"));
dForm.setId(rs.getString("empno"));
dForm.setName(rs.getString("ename"));
dForm.setJob(rs.getString("job"));
dForm.setHiredate(rs.getString("hiredate"));
}
} catch (Exception e) {
e.printStackTrace();
}
}

}
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This isn't a Struts question--you want the JDBC forum.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic