Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- PrintWriter out = response.getWriter();
- String answr="";
- String ques = request.getParameter("ques");
- String lang = request.getParameter("lang");
- String opt1=request.getParameter("opt1");
- String opt2=request.getParameter("opt2");
- String opt3=request.getParameter("opt3");
- String opt4=request.getParameter("opt4");
- String ans[]=request.getParameterValues("opt");
- int i;
- for(i=0;i<ans.length;i++)
- {
- answr=ans[i];
- }
- try{
- Class.forName("oracle.jdbc.driver.OracleDriver");
- Connection con=DriverManager.getConnection(
- "jdbc:oracle:thin:@localhost:1521:xe","system","oracle");
- PreparedStatement ps=con.prepareStatement("insert into addques values(add_ques.NEXTVAL,?,?,?,?,?,?,?)");
- ps.setString(2,ques);
- ps.setString(3,opt1);
- ps.setString(4,opt2);
- ps.setString(5,opt3);
- ps.setString(6,opt4);
- ps.setString(7,answr);
- ps.setString(8,lang );
- int j=ps.executeUpdate();
- if(j>0)
- {
- out.println("<script language='javascript'>alert('Account successfully created! Login to continue!'); window.location.href=welcome.jsp'</script>");
- }
- }
- catch (Exception e2) {System.out.println(e2);
- }
- out.close();
Add Comment
Please, Sign In to add comment