<% try{ Connection conn = null; Class.forName("sun.jdbc.odbc.JdbcOdbcDriver").newInstance(); conn = DriverManager.getCon" name="description">

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:
Advertisements