📜  语句 delete sql java 代码示例

📅  最后修改于: 2022-03-11 14:52:13.749000             🧑  作者: Mango

代码示例1
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);
    }
}