tried the code for deletion:
<%
Connection con=null;
java.sql.Statement stmt=null;
ResultSet rs=null;
boolean y=false;
int i;
String xy=(String)session.getAttribute("y");
%>
<form action="phd_projects_deleted.jsp" method="post" onSubmit="return confirm_me()">
<table border="1" cellpadding="1" cellspacing="1">
<th>
<% out.print("Project Title"); %>
</th>
<th>
<% out.print("Year"); %>
</th>
<th>
Delete Records
</th>
<%
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
con=DriverManager.getConnection("jdbc
dbc:mech_iit");
stmt=con.createStatement();
int count=0;
rs=stmt.executeQuery("select top 4* from phd_projects where user_login='"+xy+"' order by phd_id");
while(rs.next()) {
count++;
%>
<tr>
<td><% out.print(rs.getObject(2).toString()); %>
</td>
<td><% out.print(rs.getObject(5).toString()); %>
</td>
<td>
<input type="checkbox" name="var_phd_id" value="+rs.getString("phd_id")">
</td>
</tr>
<%
}
if(count==0)
{
{
out.println("<p><b>No records found</b></p>");
}
}
}
catch(Exception e)
{
System.out.println("exception in block"+e);
}
rs.close();
con.close();
%>
</table>
<p> </p>
<input type="submit" name="submit" value="delete">
<input type="reset" name="cancel" value="cancel">
</form>
phd_id is my identtity column in the phd_projects table..
and on submitting the form.. in the next page..
wrote this :
String id[]=request.getParameterValues("var_phd_id");
String xy=(String)session.getAttribute("y");
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
con=DriverManager.getConnection("jdbc
dbc:mech_iit");
stmt=con.createStatement();
String ids[]=request.getParameterValues("var_project_id");
rs=stmt.executeQuery("delete from phd_projects where phd_id in(id)");
stmt.close();
con.close();
}
catch(Exception e)
{
System.out.println(e);
}
%>
bt it gives the error as invalid column name 'id'