Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- String[] id = request.getParameterValues("deletechkbox");
- int count=0;
- Connection conn = null;
- try {
- Class.forName("com.mysql.jdbc.Driver");
- // Step 2: Define Connection URL
- String connURL = "jdbc:mysql://localhost/medicloud?user=root&password=root";
- // Step 3: Establish connection to URL
- conn = DriverManager.getConnection(connURL);
- if (id != null)
- {
- for(int i=0; i<id.length; i++){
- String sqlStr = "DELETE from exercise1 where id=?";
- PreparedStatement pstmt = conn.prepareStatement(sqlStr);
- pstmt.setInt(3, Integer.parseInt(id[i]));
- int rec = pstmt.executeUpdate();
- if (rec==1)
- count++;
- }
- }
Add Comment
Please, Sign In to add comment