im doing project on autobizz where i need to track the order and display the dept name where it is currently present..
while executing these codes, i found an error saying : After end of ResultSet..
pls help me out.. its urgent..
java prg::
Expand|Select|Wrap|Line Numbers
- public class Orderstatus {
- List <Orderstatus> list;
- private int order_no;
- private String deptName;
- ResultSet rset;
- public int getOrder_No() {
- return order_no;
- }
- public void setOrder_No(int order_no) {
- this.order_no = order_no;
- }
- public String getDeptName(){
- return deptName;
- }
- public void setDeptName(String deptName){
- this.deptName = deptName;
- }
- public String reset(){
- order_no=0;
- return "reset";
- }
- public String mkDeptName() {
- String dn=null;
- try{
- String sql = "select deptName from dept d,tracking t where d.deptID=t.deptID and t.orderNO="+order_no+"";
- System.out.println(" dept : "+sql);
- rset= DBHelper.executeQuery(sql);
- if(rset.next()){
- dn=rset.getString("deptName");}
- //dn=String.valueOf(DBHelper.executeQuery(sql));
- System.out.println("after execution...");
- System.out.println("** "+rset.getString(1));
- //this.deptName = dn;
- this.deptName=dn;
- }
- catch(Exception e){
- System.out.println(e);
- }
- return "success";
- }
- my JSP::
- <h:form>
- <h:panelGrid columns="2">
- <h:outputLabel value="Order No"></h:outputLabel>
- <h:inputText value="#{orderstatus.order_No}"> <f:validateLength minimum="1" maximum="4"></f:validateLength>
- </h:inputText>
- </h:panelGrid>
- <h:commandButton id="search" value="Status" action="#{orderstatus.mkDeptName}"></h:commandButton>
- <h:commandButton id="reset" value="Reset" action="#{orderstatus.reset}"></h:commandButton>
- <h:panelGroup >
- <h3> Your Order Status </h3>
- <h:outputLabel value="Status "></h:outputLabel>
- <h:outputLabel id="dept" value="#{orderstatus.deptName}"></h:outputLabel>
- </h:panelGroup>
- </h:form>
and error::
dept : select deptName from dept d,tracking t where d.deptID=t.deptID and t.orderNO=3321
inside executeQuery :select deptName from dept d,tracking t where d.deptID=t.deptID and t.orderNO=3321
inside executeQuery :
after execution...
java.sql.SQLException: After end of result set