473,325 Members | 2,860 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,325 software developers and data experts.

how to search a data in mysqlDB from the input text and display the result in jsp

Help me..
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
  1. public class Orderstatus {
  2.     List <Orderstatus> list;
  3.     private int order_no; 
  4.     private String deptName;
  5.     ResultSet rset;
  6.     public int getOrder_No() {
  7.         return order_no;
  8.     }
  9.     public void setOrder_No(int order_no) {
  10.         this.order_no = order_no;
  11.     }
  12.     public String getDeptName(){
  13.         return deptName;
  14.     }
  15.     public void setDeptName(String deptName){
  16.         this.deptName = deptName;
  17.     }
  18.     public String reset(){
  19.         order_no=0;
  20.         return "reset";
  21.     }
  22.     public String mkDeptName() {
  23.         String dn=null;
  24.          try{
  25.              String sql = "select deptName from dept d,tracking t where d.deptID=t.deptID and t.orderNO="+order_no+"";
  26.         System.out.println(" dept : "+sql);
  27.         rset= DBHelper.executeQuery(sql);
  28.         if(rset.next()){
  29.             dn=rset.getString("deptName");}
  30.         //dn=String.valueOf(DBHelper.executeQuery(sql));
  31.         System.out.println("after execution...");
  32.         System.out.println("**  "+rset.getString(1));
  33.         //this.deptName = dn;
  34.         this.deptName=dn;
  35.          }
  36.  
  37.          catch(Exception e){
  38.              System.out.println(e);
  39.          }
  40.         return "success";
  41.     }
  42.  
  43. my JSP::
  44. <h:form>
  45.         <h:panelGrid columns="2">
  46.             <h:outputLabel value="Order No"></h:outputLabel>
  47.             <h:inputText  value="#{orderstatus.order_No}"> <f:validateLength minimum="1" maximum="4"></f:validateLength>
  48.             </h:inputText>
  49.         </h:panelGrid>
  50.         <h:commandButton  id="search" value="Status" action="#{orderstatus.mkDeptName}"></h:commandButton>
  51.         <h:commandButton  id="reset" value="Reset" action="#{orderstatus.reset}"></h:commandButton>
  52.  
  53.     <h:panelGroup >
  54.     <h3> Your Order Status </h3>
  55.     <h:outputLabel value="Status "></h:outputLabel>
  56.     <h:outputLabel id="dept" value="#{orderstatus.deptName}"></h:outputLabel>
  57.  
  58.     </h:panelGroup>
  59. </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
Apr 29 '11 #1
0 1267

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: Walter | last post by:
Hi, The user has to type his name into input a input field (type = text). This name must be passed to another ASP file. I did this but nothing happened: <form id=ins method="post"...
4
by: multimatum2 | last post by:
Hello, I need to enable/disable input text forms... But... I need to have the same style (color...) in both modes.. Could you help me ? Thanx a lot A small sample... ...
1
by: Miguel Dias Moura | last post by:
Hello, What I know: To send a Value in the URL and filter the results in order to display only the database records which FIELD_A = Value. What I need to do: I have a page with an Input...
2
by: sympatico | last post by:
hi, pls help me slove this problem. i am a newbie in using asp.net and SQL server 2000 and my problem for now is to pass data to a textfile and i have fail to do so. the way i did it was i used...
3
by: Ali | last post by:
I have 3 html input tex in my asp.net form. Two of them are calling javascript client side to calculate the differnce of two dates and put the result into the third input text. i haven't include...
2
by: magix | last post by:
Hi, I'm using Access Database with ASP. There is one particular thing that I have issue with. My purpose is for user to update their own profile. Their existing profile information will be...
3
by: acecraig100 | last post by:
I am fairly new to Javascript. I have a form that users fill out to enter an animal to exhibit at a fair. Because we have no way of knowing, how many animals a user may enter, I created a table...
3
by: jonniethecodeprince | last post by:
Hi all, I have trouble getting an array of data stored in a separate javascript file i.e. a file called books.js into a table of data for a .xhtml file. There are 50 Records in this file....
2
by: 848lu | last post by:
hi, im trying to search data through an array and then display the macthes found please help #!/usr/bin/php <HTML> <BODY> <? #reads a text file outputs it to screen
3
by: hazahafiz | last post by:
how to solve??? i want to search data for more than 1 criteria in one interface.for example,i want to search location,price and type.then, i want use drop down list for select each criteria and...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.