<html>
<body>
<%@page import="java.sql.*"%>
<form method="post" action="csea.jsp">
<table border="1">
<tr><th>Reg No</th><th>Name</th><th>Present/Absent</th></tr>
<%
String pa = request.getParameter("pa");
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con = DriverManager.getConnection("jdbc:odbc:Student");
Statement st = con.createStatement();
ResultSet rs = st.executeQuery("select * from student_details");
while (rs.next()) {
%>
<tr><th><%=rs.getString("reg_no")%></th><th><%=rs.getString("s_name")%></th>
<th><input type="text" name="pa"/></th>
</tr>
<%
}
st.executeUpdate("update csea set pa='"+pa+"'");
con.close();
st.close();
rs.close();
} catch (Exception e) {
}%>
</table>
<input type="submit" name="submit" value="SUBMIT"/>
</form>
</body>
</html>
In this code the problem am facing is that when am insert the student status as "present" then it the status is updating to all s_name column
example: suppose they are 3 student are their in msaccess table
reg_no s_name present/absent
1 x present
2 Y present
3 z present
now i want put status as present, absent and present but by this code the all 3 student is showing all present.
Regards,
Abrar.