File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Struts and the fly likes Invalid operation for forward only resultset : last Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Invalid operation for forward only resultset : last" Watch "Invalid operation for forward only resultset : last" New topic
Author

Invalid operation for forward only resultset : last

pankaj semwal
Ranch Hand

Joined: Oct 07, 2008
Posts: 300
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

Joined: Sep 29, 2008
Posts: 12617

This isn't a Struts question--you want the JDBC forum.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Invalid operation for forward only resultset : last