Lab complete?
This commit is contained in:
		
							parent
							
								
									1314e0e2b6
								
							
						
					
					
						commit
						db20aa2f53
					
				
					 2 changed files with 2 additions and 1 deletions
				
			
		|  | @ -56,7 +56,7 @@ public class Database implements AutoCloseable { | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	public boolean addAnswer(String name, String answerOne, String answerTwo, String answerThree, String answerFour) { | 	public boolean addAnswer(String name, String answerOne, String answerTwo, String answerThree, String answerFour) { | ||||||
| 		String sql = "insert into Answer (answerOne, answerTwo, answerThree, answerFour, name) values(?,?,?,?,?)"; | 		String sql = "insert into Answers (answerOne, answerTwo, answerThree, answerFour, name) values(?,?,?,?,?)"; | ||||||
| 
 | 
 | ||||||
| 		try (PreparedStatement ps = conn.prepareStatement(sql)) { | 		try (PreparedStatement ps = conn.prepareStatement(sql)) { | ||||||
| 			ps.setString(1, answerOne); | 			ps.setString(1, answerOne); | ||||||
|  |  | ||||||
|  | @ -123,6 +123,7 @@ public class Survey extends HttpServlet { | ||||||
| 					// display the next page | 					// display the next page | ||||||
| 					if (valuesOk){ | 					if (valuesOk){ | ||||||
| 						int sum = s11 + s12 + s13 + s14; | 						int sum = s11 + s12 + s13 + s14; | ||||||
|  | 						db.addAnswer(name, s11String, s12String, s13String, s14String); | ||||||
| 						// This is only to show that it is possible to do something with the values.  | 						// This is only to show that it is possible to do something with the values.  | ||||||
| 						// It is of course meaningless to calculate the sum.  | 						// It is of course meaningless to calculate the sum.  | ||||||
| 						out.println("<p> Hello " + name); | 						out.println("<p> Hello " + name); | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Imbus
						Imbus