<tr>
<td width="60"height="30">
<select name='class_name'>
<%
for(int i=1;i<12;i++)
{
out.println("<option value="+i+">"+i+"</option>");
}
%>
</td>
<select name='from_year'>
<%
for(int i=2010;i>2000;i--)
{
out.println("<option value="+i+">"+i+"</option>");
}
%>
</td>
<td>
<select name='to_year'>
<%
for(int i=2010;i>2000;i--)
{
out.println("<option value="+i+">"+i+"</option>");
}
%>
</td>
<td>
<input type="submit" name="submit" value="Go" ></td>
</tr>
<table align="center" border="1" align="center">
<br>
<tr bgcolor="#36559E" align="center">
<td width="150"height="30"><font size="+1">Year</td></font>
<td width="150"height="30"><font size="+1">Class</td></font>
<td width="150"height="30"><font size="+1">Subject</td></font>
<td width="150"height="30"><font size="+1">Total Students</td></font>
<td width="150"height="30"><font size="+1">Passout Students</td></font>
<td width="150"height="30"><font size="+1">Marks Obtained 60 To 80</td></font>
<td width="150"height="30"><font size="+1">Marks Obtained over 80</td></font>
<td width="150"height="30"><font size="+1">Overall Result</td></font>
</tr>
<%
String submit=request.getParameter("submit");
if(submit!=null && (submit.equals("Go")))
{
String class_name=request.getParameter("class_name");
System.out.println("class_name is"+
class_name);
Connection con = null;
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver") ;
con = DriverManager.getConnection("jdbc:odbc:sql;user=sa;password=1234");
System.out.println("First connection ok.");
System.out.println("Connection created");
Statement st=con.createStatement();
System.out.println("st going to execute");
String query="SELECT year, class, Subject, total_students, passout_students, marks_obtained_60_to_80, marks_obtained_above_80, overall_result FROM Result where class=' "+class_name+" ' ";
System.out.println("now data are selecting");
ResultSet rs=st.executeQuery(query);
System.out.println("now data in rs.....");
System.out.println("now going to rs block............");
while(rs.next())
{System.out.println("now in rs block............");
%>
<tr align="center">
<td width="150"height="30"><%out.println(rs.getString(1));%>
<td width="150"height="30"><%out.println(rs.getString(2));%>
<td width="150"height="30"><%out.println(rs.getString(3));%>
<td width="150"height="30"><%out.println(rs.getString(4));%>
<td width="150"height="30"><%out.println(rs.getString(5));%>
<td width="150"height="30"><%out.println(rs.getString(6));%>
<td width="150"height="30"><%out.println(rs.getString(7));%>
<td width="150"height="30"><%out.println(rs.getInt(8));%>
<td width="150"height="30"><%out.println(rs.getString(9));%>
</tr>
<%
}
rs.close();
con.close();
}catch(Exception e){out.println(e);}
}
}
%>