A friendly place for programming greenhorns!
Big Moose Saloon
Search
|
Java FAQ
|
Recent Topics
Register / Login
Win a copy of
The Mikado Method
this week in the
Agile and other Processes
forum!
JavaRanch
»
Java Forums
»
Frameworks
»
Struts
Author
Invalid operation for forward only resultset : last
pankaj semwal
Ranch Hand
Joined: Oct 07, 2008
Posts: 300
posted
Jan 19, 2009 21:43:00
0
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
I like...
posted
Jan 21, 2009 06:57:23
0
This isn't a Struts question--you want the
JDBC
forum.
subject: Invalid operation for forward only resultset : last
Similar Threads
rs.beforeFirst() exception
ResultSet not scrollable
How to get the number of rows in a ResultSet
how to dynamically set values in check box
how to dynamically set values in check box
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter