statement delete sql java

Solutions on MaxInterview for statement delete sql java by the best coders in the world

showing results for - "statement delete sql java"
Bruno
04 Jan 2017
1public static void DeleteRow(String name) {
2    try {  
3        Class.forName("com.mysql.jdbc.Driver");
4        Connection connection = DriverManager.getConnection(url, username, password);
5        PreparedStatement st = connection.prepareStatement("DELETE FROM Table WHERE name = ?");
6        st.setString(1,name);
7        st.executeUpdate(); 
8    } catch(Exception e) {
9        System.out.println(e);
10    }
11}