Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- String urlValue="";
- Scanner input = new Scanner (System.in);
- System.out.print("Masukkan id yang akan dihapus = ");
- String id = input.nextLine();
- try {
- Class.forName("com.mysql.jdbc.Driver");
- urlValue="jdbc:mysql://localhost/pbo?user=root&password=";
- Connection conn=
- DriverManager.getConnection(urlValue);
- Statement st=conn.createStatement();
- boolean rs=st.execute("delete from daftar_pasien WHERE daftar_pasien.id ='"+id+"'");
- conn.close();
- }
- catch (SQLException e){
- System.out.println("koneksi gagal" + e.toString());
- }
- catch (ClassNotFoundException e){
- System.out.println("jdbc.Driver tidak ditemukan");
- }
Add Comment
Please, Sign In to add comment