<%-- 
    Document   : eedit3
    Created on : Mar 21, 2010, 8:56:39 PM
    Author     : Sreekanth
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
   "http://www.w3.org/TR/html4/loose.dtd">
<jsp:include page="menu.jsp"></jsp:include>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
    </head>
    <body>
        <%@page language="java" import="java.util.*,java.sql.* " contentType="text/html"%>

<%             // String a= request.getParameter("QosType");
               // String b= request.getParameter("op");

           int a = Integer.parseInt( request.getParameter("qno"));
           String b =request.getParameter("qname");
           String c= request.getParameter("ans");
                
              
               
                              
		
           try {  
            
               Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
           
               Connection con=DriverManager.getConnection("jdbc:odbc:sree","sree","sree");

           
            
                PreparedStatement pstmt = con.prepareStatement("update fqb set qname='"+b+"',ans='"+c+"' where qid="+a);
                    
                
                int x=pstmt.executeUpdate();
             if(x==1)
                  {
                  request.setAttribute("sree","The question was successfully updated" );
                  RequestDispatcher dispatch=request.getRequestDispatcher("fedit.jsp");
                  dispatch.forward(request,response);
              }
              else
                {
                  request.setAttribute("sree","The question was not updated" );
                  
                  RequestDispatcher dispatch=request.getRequestDispatcher("fedit.jsp");
                  dispatch.forward(request,response);
              }
            
                 
            }
	catch(ClassNotFoundException s)
        { 
	out.println("loaderror");
   	}
	catch(SQLException e)
        { 
        out.println("SQL Error");
	out.println(e);
   }
                       
          %> 
    </body>
</html>
