Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- String id[]= new String[5];
- for(int i=1;i<=5;i++)
- {
- id[i]=request.getParameter("opt"+i);
- System.out.println(id[i]);
- }
- try{
- Class.forName("oracle.jdbc.driver.OracleDriver");
- Connection connection = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe", "nivt", "1234");
- Statement stmt=connection.createStatement();
- ResultSet rs=stmt.executeQuery("Select * from addques");
- int count=0;
- while(rs.next())
- {
- String str[]= new String[5];
- for(int j=1;j<=5;j++){
- str[j]=rs.getString("correctopt");
- System.out.println(str[j]);
- }
- for(int i=0;i<str.length;i++){
- if(id.equals(str)){
- count++;
- }
- }
- }
- out.println("Your "+count+" answers are correct");
- }
- catch(Exception e)
- {
- System.out.print(e);
- }
Add Comment
Please, Sign In to add comment