Adv Java Exp-3
Adv Java Exp-3
if(i > 0) {
System.out.println("Successfully Updated");
} else {
System.out.println("Failed");
}
}
}
Delete.java :-
package delete.com;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
public class Delete {
public static void main(String[] args) throws Exception {
// TODO Auto-generated method stub
int registrationId = 18;
Class.forName("com.mysql.cj.jdbc.Driver");
Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/database1","root","Arman5656");
System.out.println("Succesfully Loaded");
PreparedStatement ps = con.prepareStatement("Delete from registration where registrationId=?");
ps.setInt(1, registrationId);
int i = ps.executeUpdate();
if (i >0) {
System.out.println("Deletion Success");
} else {
System.out.println("Deletion Failed");
}
}
}
Concept 10
Planning and Execution/ 10
Practical Simulation/ Programming
Result and Interpretation 10
Record of Applied and Action Learning 10
Viva 10
Total 50