-
Notifications
You must be signed in to change notification settings - Fork 1
/
deletesubject.jsp
47 lines (43 loc) · 1.2 KB
/
deletesubject.jsp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
<%@ page language="java" session="true" import="java.sql.*" %>
<jsp:useBean class="connection.Conn" id="con" scope="session"/>
<%
System.out.println("------>deletesubject.jsp--");
//String p="viewsub.jsp";
//session.setAttribute("prev",p);
//System.out.println("------>VIEW SUBJECT--");
Statement stmt=con.getcon();
// out.println("--------");
String m=null;
try{
String branch=session.getAttribute("branch").toString();
String subid=request.getParameter("dsub");
System.out.println("--delete----->subid--->"+subid);
String b=null;
System.out.println("----deletesubject.jsp->"+branch);
if(branch.equals("COMPUTER SCIENCE"))
b="CS";
if(branch.equals("ELECTRONICS AND COMMUNICATION"))
b="EC";
if(branch.equals("ELECTRICAL SCIENCE"))
b="EE";
if(branch.equals("ELECTRONICS AND INSTRUMENTATION"))
b="EI";
if(branch.equals("MECHANICAL ENGINEERING"))
b="ME";
System.out.println("------->"+b);
String query="DELETE FROM "+b+"SUBJECT WHERE SUBJECTID='"+subid+"'" ;
System.out.println("--->query-->"+query);
stmt.execute(query);
System.out.println("--->subject deleted--<");
m="DELETED";
out.write(m);
//out.println("-----HEY --");
%>
<% }
catch(Exception e)
{
m="NOT";
out.write(m);
System.out.println("---->"+e);
}
%>