Can't retrieve Employee_Name + Total Gross Income
Posted by: Jack Luk
Date: October 12, 2012 11:29PM

String str = "select  e.Employee_Name, sum(i.Subincome)  from employee e RIGHT  JOIN income i "
 + "ON e.Employee_ID = i.Employee_ID "  + " where e.Employee_ID = "
 + emp_id + " group by e.Employee_Name";

pst = conn.prepareStatement(str);
rs = pst.executeQuery();
             
Employee_Name = rs.getString(1);
totalIncome = rs.getBigDecimal(2);
Error:
java.sql.SQLException: Before start of result set
	at com.mysql.jdbc.ResultSet.checkRowPos(ResultSet.java:3624)
	at com.mysql.jdbc.ResultSet.getString(ResultSet.java:1762)
	at edica.CDatabase.calculateTotalIncome(CDatabase.java:368)
Please help
Thx



Edited 1 time(s). Last edit at 10/12/2012 11:39PM by Jack Luk.

Options: ReplyQuote


Subject
Written By
Posted
Can't retrieve Employee_Name + Total Gross Income
October 12, 2012 11:29PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.