 
<jsp:include page="menu.jsp"></jsp:include>

<%@page language="java" import="java.util.*,java.sql.*,javax.swing.* ,java.lang.* " contentType="text/html"%>
<%            
	       String a=request.getParameter("qnam");
              out.print(a);
                
             try
             {
               Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
           
               Connection con=DriverManager.getConnection("jdbc:odbc:sree","sree","sree");
               PreparedStatement pstmt = con.prepareStatement("Delete from mqb where qname = '"+a+"'");
               
               int x=pstmt.executeUpdate();
                if(x==1)
                  {

                  request.setAttribute("sree","<h2>The question was successfully deleted</h2>" );
                  RequestDispatcher dispatch=request.getRequestDispatcher("mdelete.jsp");
                  dispatch.forward(request,response);

              }
              else
                {
 

                  request.setAttribute("sree","<h1>The question does not exist</h1>" );
                  RequestDispatcher dispatch=request.getRequestDispatcher("mdelete.jsp");
                  dispatch.forward(request,response);
                }
     }
catch(SQLException e)
{
    out.println(e);
}  
catch(Exception e)
{
    out.println(e);
}                                                            
 %>              