Home

Published

- 1 min read

statement delete sql java

img of statement delete sql java

The solution for this is noted below

statement delete sql java

Solution

   public static void DeleteRow(String name) {
    try {
        Class.forName("com.mysql.jdbc.Driver");
        Connection connection = DriverManager.getConnection(url, username, password);
        PreparedStatement st = connection.prepareStatement("DELETE FROM Table WHERE name = ?");
        st.setString(1,name);
        st.executeUpdate();
    } catch(Exception e) {
        System.out.println(e);
    }
}

Try other methods by searching on the site. That is if this doesn’t work