why the program is showing error?

why the program is showing error?

<%@page import="java.sql.*"%>

<%
try{
Connection conn = null;
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver").newInstance();
conn = DriverManager.getConnection("jdbc:odbc:sample");
Statement st=null;
st=conn.createStatement();
String query = "select * from projection";
ResultSet rs=st.executeQuery(query);

Statement st1=null;
st1=conn.createStatement();
Statement st2=null;
st2=conn.createStatement();


while(rs.next())
{
    String catsid=rs.getString(3);
    String empid=rs.getString(2);
    String query1="select *from CATS_Dump where PersonNo='"+catsid+"' ";
    out.println("hi");
    try{
    ResultSet rs1=st1.executeQuery(query1);
    }catch(Exception e1)
    { e1.printStackTrace();}
    out.println("hi");

    Integer i=0;
    out.println("hi");

    while(rs1.next())
    {
        Integer k=Integer.parseInt(rs1.getString(10));
        i=i+k;
    }

    st2.executeUpdate("update dft set Actual_CFTE='"+i+"' where EmployeeId='"+empid+"' "); 

}
}
catch(Exception e){
System.out.println(e);
}


%>

It is showing the error:

An error occurred at line: 33 in the jsp file: /sampledft.jsp
rs1 cannot be resolved
30:     Integer i=0;
31:     out.println("hi");
32: 
33:     while(rs1.next())
34:     {
35:         Integer k=Integer.parseInt(rs1.getString(10));
36:         i=i+k;


An error occurred at line: 35 in the jsp file: /sampledft.jsp
rs1 cannot be resolved
32: 
33:     while(rs1.next())
34:     {
35:         Integer k=Integer.parseInt(rs1.getString(10));
36:         i=i+k;
37:     }
38:     
View Answers









Related Tutorials/Questions & Answers:
why the program is showing error?
errore
Advertisements
Java Program Errors
Java is an opensource program or not? why???
Any specific log4j statements for Hibernate Envers for showing the Envers related errors
why java program not run with msword editor
java find the error1
java find the error4
java find the error7
java find the error3
java find the error2
errors
java find the error5
Why is my program running an infinite loop? Parallel Arrays Program
for writting java program why we are taking more than one class
Runtime Errors
why and where we use setter and getter methods in java, please give me one example program.....
check for errors
Is it modify Object data? Generally Object data can't modify............but in this program it modifies.......... Why?
ModuleNotFoundError: No module named 'errors'
Showing div at the center of the webpage
What is the errors?
errors
java find the error6
Need urgent help with C++ errors!
Servlets errors in same page.
showing the information of database in textbox
compilation errors
types of errors in php
java errors
ModuleNotFoundError: No module named 'django-errors'
ModuleNotFoundError: No module named 'haiku-errors'
ModuleNotFoundError: No module named 'masonite-errors'
ModuleNotFoundError: No module named 'pretty-errors'
ModuleNotFoundError: No module named 'edeposit.amqp_errors'
compiled but showing below error
hibernate record not showing in database - Hibernate
jframe background color not showing
Why spring?
Compiler errors in java
Why NSMutableDictionary
selectoptions errors in java script
The errors tag
Correct errors - Java Beginners
ModuleNotFoundError: No module named 'django-client-errors'
ModuleNotFoundError: No module named 'drf-friendly-errors'
ModuleNotFoundError: No module named 'cf-pretty-form-errors'
ModuleNotFoundError: No module named 'datasette-show-errors'
ModuleNotFoundError: No module named 'django-client-errors'
ModuleNotFoundError: No module named 'drf-friendly-errors'

Ads