Search This Blog

Thursday, 4 September 2014

14. JSP Program to Generate Marks Sheets of all the Students from the Database.

Filename: Stud14.jsp
<!-- 14. JSP Program to Generate Marks Sheets of all the Students from the Database. -->
<html>
<head>
<title>Student Information</title>
<%@page import="java.sql.*,java.util.*"%>
</head>
<body>
<CENTER><h2><font color="blue" >Marks Sheets of all the Students</font></h2></CENTER>

<%
    String sname=request.getParameter("sname");

    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    Connection con = DriverManager.getConnection("jdbc:odbc:stud14");
    Statement st=con.createStatement();
   
    ResultSet rs=st.executeQuery("select * from stud14");
   
    while(rs.next())
    {
%>
    <CENTER>
    <table border=5 bgcolor="orange" height=600 width=400 >
    <caption><h3><font color="blue" >Marks Sheet</font></h3></caption>
    <tr><td>Name</td><td><%=rs.getString("sname")%></td></tr>
    <tr><td>Register Number</td><td><%=rs.getString("regno")%></td></tr>
    <tr><td>Course</td><td><%=rs.getString("course")%></td></tr>
    <tr><td>Subject1</td><td><%=rs.getString("sub1")%></td></tr>
    <tr><td>Subject2</td><td><%=rs.getString("sub2")%></td></tr>
    <tr><td>Subject3</td><td><%=rs.getString("sub3")%></td></tr>
    <tr><td>Subject4</td><td><%=rs.getString("sub4")%></td></tr>
    <tr><td>Subject5</td><td><%=rs.getString("sub5")%></td></tr>
    <tr><td>Total</td><td><%=rs.getString("total")%></td></tr>

    <tr><td>Percent</td><td><%=rs.getString("percent")%></td></tr>
    <tr><td>Grade</td><td><%=rs.getString("grade")%></td></tr>
    </table>
    </CENTER>
    <br>

<%
    }
   

    rs.close();
    st.close();
    con.close();

%>

</body>
</html>

No comments :

Post a Comment

FREE Hit Counters